Don't leak memory on failure.
authorAndrew Bartlett <abartlet@samba.org>
Thu, 21 Mar 2002 04:00:25 +0000 (04:00 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 21 Mar 2002 04:00:25 +0000 (04:00 +0000)
source/passdb/passdb.c

index 2f19698ffa9bc68cb5039283c8cde4248cca9fce..9b1bd3d211c30d5794773a00a4e45698685060e1 100644 (file)
@@ -757,8 +757,10 @@ DOM_SID *local_uid_to_sid(DOM_SID *psid, uid_t uid)
        if(!(pass = getpwuid_alloc(uid)))
                return NULL;
 
-       if (NT_STATUS_IS_ERR(pdb_init_sam(&sam_user)))
+       if (NT_STATUS_IS_ERR(pdb_init_sam(&sam_user))) {
+               passwd_free(&pass);
                return NULL;
+       }
        
        if (!pdb_getsampwnam(sam_user, pass->pw_name)) {
                pdb_free_sam(&sam_user);