2 fixes to enhance readability of source code and debug messages
authorSimo Sorce <idra@samba.org>
Mon, 8 Mar 2004 09:52:17 +0000 (09:52 +0000)
committerSimo Sorce <idra@samba.org>
Mon, 8 Mar 2004 09:52:17 +0000 (09:52 +0000)
1 fix for a memleak

source/lib/privileges.c
source/passdb/passdb.c
source/smbd/sec_ctx.c

index 4bcf5e3b36ba9cd6eb40235fdd4a5c976b3c5fbd..a3b85372c7f35247d439f2c9ed4f53384da4aff4 100644 (file)
@@ -372,7 +372,7 @@ NTSTATUS dup_priv_set(PRIVILEGE_SET *new_priv_set, PRIVILEGE_SET *priv_set)
        LUID_ATTR *old_set;
        int i;
 
-       if (!new_priv_set || !priv_set)
+       if (new_priv_set == NULL || priv_set == NULL)
                return NT_STATUS_INVALID_PARAMETER;
 
        /* special case if there are no privileges in the list */
index 7c9376e045a03f327adb0b23c5ddf882c495a85a..273428dacf187842d7f591399e759379bfec0abe 100644 (file)
@@ -1892,6 +1892,8 @@ BOOL init_sam_from_buffer_v1(SAM_ACCOUNT *sampass, uint8 *buf, uint32 buflen)
 
 done:
 
+       SAFE_FREE(lm_pw_ptr);
+       SAFE_FREE(nt_pw_ptr);
        SAFE_FREE(username);
        SAFE_FREE(domain);
        SAFE_FREE(nt_username);
index 9244f34394e5bdce60130d3cbb1590be32977d81..97fe2dfaee1b4b37d3526f11d2a2fa6fddc106ae 100644 (file)
@@ -258,7 +258,7 @@ BOOL push_sec_ctx(void)
 
        ctx_p->token = dup_nt_token(sec_ctx_stack[sec_ctx_stack_ndx-1].token);
        if (! ctx_p->token) {
-               DEBUG(0, ("Out of memory in push_sec_ctx()\n"));
+               DEBUG(0, ("Out of memory on dup_nt_token() in push_sec_ctx()\n"));
                return False;
        }
 
@@ -266,7 +266,7 @@ BOOL push_sec_ctx(void)
 
        if (ctx_p->ngroups != 0) {
                if (!(ctx_p->groups = malloc(ctx_p->ngroups * sizeof(gid_t)))) {
-                       DEBUG(0, ("Out of memory in push_sec_ctx()\n"));
+                       DEBUG(0, ("Out of memory on malloc() in push_sec_ctx()\n"));
                        delete_nt_token(&ctx_p->token);
                        return False;
                }
@@ -278,7 +278,7 @@ BOOL push_sec_ctx(void)
 
        init_privilege(&ctx_p->privs);
        if (! NT_STATUS_IS_OK(dup_priv_set(ctx_p->privs, sec_ctx_stack[sec_ctx_stack_ndx-1].privs))) {
-               DEBUG(0, ("Out of memory in push_sec_ctx()\n"));
+               DEBUG(0, ("Out of memory on dup_priv_set() in push_sec_ctx()\n"));
                delete_nt_token(&ctx_p->token);
                destroy_privilege(&ctx_p->privs);
                return False;