pam: Fix CID 1034870 Resource leak
authorVolker Lendecke <vl@samba.org>
Tue, 3 Mar 2015 15:11:26 +0000 (16:11 +0100)
committerRalph Böhme <slow@samba.org>
Tue, 3 Mar 2015 16:34:39 +0000 (17:34 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
nsswitch/pam_winbind.c

index f1b88cba4bb069d2ad46562c8ee1ee3b577f8cc3..c6467c76d8df5fd2b38ca7926d2f386673749dcc 100644 (file)
@@ -2436,6 +2436,7 @@ static char* winbind_upn_to_username(struct pwb_context *ctx,
        char *domain = NULL;
        char *name;
        char *p;
+       char *result;
 
        /* This cannot work when the winbind separator = @ */
 
@@ -2467,7 +2468,9 @@ static char* winbind_upn_to_username(struct pwb_context *ctx,
                return NULL;
        }
 
-       return talloc_asprintf(ctx, "%s%c%s", domain, sep, name);
+       result = talloc_asprintf(ctx, "%s%c%s", domain, sep, name);
+       wbcFreeMemory(domain);
+       return result;
 }
 
 static int _pam_delete_cred(pam_handle_t *pamh, int flags,