Don't leak data.dptr on error path.
authorMichael Adam <obnox@samba.org>
Tue, 8 Jan 2008 20:51:07 +0000 (21:51 +0100)
committerMichael Adam <obnox@samba.org>
Wed, 9 Jan 2008 00:47:10 +0000 (01:47 +0100)
Michael
(This used to be commit d14de0692c623ff07dada45a3d7bec03ceca2b7e)

source3/groupdb/mapping_tdb.c

index cf9f9058afc7b6cac5a0d71915d1c64f04798f01..9adde40426a2407beeaf4d966bfc6c824b68b433 100644 (file)
@@ -394,6 +394,7 @@ static NTSTATUS one_alias_membership(const DOM_SID *member,
        char *string_sid;
        TDB_DATA dbuf;
        const char *p;
+       NTSTATUS status;
        TALLOC_CTX *frame;
 
        slprintf(key, sizeof(key), "%s%s", MEMBEROF_PREFIX,
@@ -414,14 +415,15 @@ static NTSTATUS one_alias_membership(const DOM_SID *member,
                        continue;
 
                if (!add_sid_to_array_unique(NULL, &alias, sids, num)) {
-                       TALLOC_FREE(frame);
-                       return NT_STATUS_NO_MEMORY;
+                       status = NT_STATUS_NO_MEMORY;
+                       goto done;
                }
        }
 
+done:
        TALLOC_FREE(frame);
        SAFE_FREE(dbuf.dptr);
-       return NT_STATUS_OK;
+       return status;
 }
 
 static NTSTATUS alias_memberships(const DOM_SID *members, size_t num_members,