1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-24 13:57:43 +03:00

nsswitch:krb5_plugin: Avoid a possible double free

Found by Covscan.

"Error: USE_AFTER_FREE (CWE-416):
samba-4.20.0rc2/nsswitch/krb5_plugin/winbind_krb5_localauth.c:122: freed_arg: ""wbcFreeMemory"" frees ""pwd"".
samba-4.20.0rc2/nsswitch/krb5_plugin/winbind_krb5_localauth.c:144: pass_freed_arg: Passing freed pointer ""pwd"" as an argument to ""wbcFreeMemory"".
  142|   		break;
  143|   	}
  144|-> 	wbcFreeMemory(pwd);
  145|   	if (code != 0) {
  146|   		goto out;"

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
This commit is contained in:
Andreas Schneider 2024-06-18 15:45:53 +02:00 committed by Andreas Schneider
parent 5b40cdf6e8
commit 36fb8a3d65

View File

@ -120,6 +120,7 @@ static krb5_error_code winbind_userok(krb5_context context,
break;
}
wbcFreeMemory(pwd);
pwd = NULL;
if (code != 0) {
goto out;
}