pam_winbind: Fix a memleak
authorVolker Lendecke <vl@samba.org>
Fri, 4 Nov 2022 10:23:52 +0000 (11:23 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 22 Nov 2022 18:27:33 +0000 (18:27 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
nsswitch/pam_winbind.c

index 06a8db21b690afb84ec22b1fc22ee728c512ffed..87aa79de82c72bfb2807b08d79a1c6e685b70536 100644 (file)
@@ -2461,6 +2461,7 @@ static char winbind_get_separator(struct pwb_context *ctx)
 {
        wbcErr wbc_status;
        static struct wbcInterfaceDetails *details = NULL;
+       char result;
 
        wbc_status = wbcCtxInterfaceDetails(ctx->wbc_ctx, &details);
        if (!WBC_ERROR_IS_OK(wbc_status)) {
@@ -2474,7 +2475,9 @@ static char winbind_get_separator(struct pwb_context *ctx)
                return '\0';
        }
 
-       return details->winbind_separator;
+       result = details->winbind_separator;
+       wbcFreeMemory(details);
+       return result;
 }