1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

nsswitch: Fix memory leak in wbinfo_auth_krb5()

Direct leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x7ff206afc130 in calloc ../../../../libsanitizer/asan/asan_malloc_linux.cpp:77
    #1 0x7ff206837054 in wbcAllocateMemory ../../nsswitch/libwbclient/wbclient.c:216
    #2 0x7ff20683c76a in wbc_create_password_policy_info ../../nsswitch/libwbclient/wbc_pam.c:295
    #3 0x7ff20683c76a in wbcCtxLogonUser ../../nsswitch/libwbclient/wbc_pam.c:1290
    #4 0x7ff20683caec in wbcLogonUser ../../nsswitch/libwbclient/wbc_pam.c:1307
    #5 0x556ea348db12 in wbinfo_auth_krb5 ../../nsswitch/wbinfo.c:1723
    #6 0x556ea348db12 in main ../../nsswitch/wbinfo.c:3238
    #7 0x7ff203c2a2ad in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
Andreas Schneider 2024-10-15 08:51:43 +02:00 committed by Martin Schwenke
parent 826b75bf03
commit 6a1196c567

View File

@ -1656,9 +1656,9 @@ static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32_t flags)
char *local_cctype = NULL;
uid_t uid;
struct wbcLogonUserParams params;
struct wbcLogonUserInfo *info;
struct wbcAuthErrorInfo *error;
struct wbcUserPasswordPolicyInfo *policy;
struct wbcLogonUserInfo *info = NULL;
struct wbcAuthErrorInfo *error = NULL;
struct wbcUserPasswordPolicyInfo *policy = NULL;
TALLOC_CTX *frame = talloc_tos();
if ((s = talloc_strdup(frame, username)) == NULL) {
@ -1762,7 +1762,9 @@ static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32_t flags)
}
}
done:
wbcFreeMemory(error);
wbcFreeMemory(policy);
wbcFreeMemory(info);
wbcFreeMemory(params.blobs);
return WBC_ERROR_IS_OK(wbc_status);