r15830: fixed two kdc memory leaks
authorAndrew Tridgell <tridge@samba.org>
Tue, 23 May 2006 05:14:06 +0000 (05:14 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:08:30 +0000 (14:08 -0500)
source/kdc/hdb-ldb.c
source/kdc/kdc.c

index c1ed262f7d4fd122b6fc4a0f36aec2dc848c8259..cc354af9e916d38f12409d6c558ac0e120cac663 100644 (file)
@@ -799,27 +799,21 @@ static krb5_error_code LDB_fetch(krb5_context context, HDB *db,
 
        if (flags & HDB_F_GET_CLIENT) {
                ret = LDB_fetch_client(context, db, mem_ctx, principal, flags, entry_ex);
-               if (ret != HDB_ERR_NOENTRY) {
-                       talloc_free(mem_ctx);
-                       return ret;
-               }
+               if (ret != HDB_ERR_NOENTRY) goto done;
        }
        if (flags & HDB_F_GET_SERVER) {
                ret = LDB_fetch_server(context, db, mem_ctx, principal, flags, entry_ex);
-               if (ret != HDB_ERR_NOENTRY) {
-                       return ret;
-               }
+               if (ret != HDB_ERR_NOENTRY) goto done;
                ret = LDB_fetch_krbtgt(context, db, mem_ctx, principal, flags, entry_ex);
-               if (ret != HDB_ERR_NOENTRY) {
-                       return ret;
-               }
+               if (ret != HDB_ERR_NOENTRY) goto done;
        }
        if (flags & HDB_F_GET_KRBTGT) {
                ret = LDB_fetch_krbtgt(context, db, mem_ctx, principal, flags, entry_ex);
-               if (ret != HDB_ERR_NOENTRY) {
-                       return ret;
-               }
+               if (ret != HDB_ERR_NOENTRY) goto done;
        }
+
+done:
+       talloc_free(mem_ctx);
        return ret;
 }
 
index 4ce17a871860c33a3bf94cb083692c5562122e17..10e0764e233381d872c922760a4a008c80e24db6 100644 (file)
@@ -127,7 +127,7 @@ static void kdc_recv_handler(struct kdc_socket *kdc_socket)
                return;
        }
 
-       blob = data_blob_talloc(kdc_socket, NULL, dsize);
+       blob = data_blob_talloc(tmp_ctx, NULL, dsize);
        if (blob.data == NULL) {
                /* hope this is a temporary low memory condition */
                talloc_free(tmp_ctx);