From ad3e38f6bb65fdf16cc792b97333a74d49f345bf Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 3 Mar 2015 16:11:26 +0100 Subject: [PATCH] pam: Fix CID 1034870 Resource leak Signed-off-by: Volker Lendecke Reviewed-by: Ralph Boehme --- nsswitch/pam_winbind.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c index f1b88cba4bb..c6467c76d8d 100644 --- a/nsswitch/pam_winbind.c +++ b/nsswitch/pam_winbind.c @@ -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, -- 2.34.1