1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

nsswitch/libwbclient: clang Fix Potential leak of memory

Fixes:

nsswitch/libwbclient/wbc_sid.c:848:2: warning: Potential leak of memory pointed to by 'extra_data'
        free(extra_data);
        ^
1 warning generated.
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
Noel Power 2019-07-08 12:12:59 +00:00 committed by Gary Lockyer
parent c80606274f
commit c19f1c9a3e

View File

@ -792,12 +792,14 @@ wbcErr wbcCtxGetSidAliases(struct wbcContext *ctx,
sid_len = wbcSidToStringBuf(&sids[i], sid_str, sizeof(sid_str));
if (buflen < extra_data_len + sid_len + 2) {
char * tmp_data = NULL;
buflen *= 2;
extra_data = (char *)realloc(extra_data, buflen);
if (!extra_data) {
tmp_data = (char *)realloc(extra_data, buflen);
if (!tmp_data) {
wbc_status = WBC_ERR_NO_MEMORY;
BAIL_ON_WBC_ERROR(wbc_status);
}
extra_data = tmp_data;
}
strncpy(&extra_data[extra_data_len], sid_str,