Zhiyi Zhang : wbemprox: Fix a memory leak (Coverity).
Module: wine Branch: master Commit: a2fdae65a173668186a828447688fa2404a3ac49 URL: https://gitlab.winehq.org/wine/wine/-/commit/a2fdae65a173668186a828447688fa2... Author: Zhiyi Zhang <zzhang(a)codeweavers.com> Date: Sat Nov 25 23:07:41 2023 +0800 wbemprox: Fix a memory leak (Coverity). When LsaLookupSids() fails with STATUS_NONE_MAPPED or STATUS_SOME_NOT_MAPPED, the memory returned by the domain parameter should be freed. --- dlls/wbemprox/builtin.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index e751299e4e6..31df1f5c920 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -3982,6 +3982,7 @@ static enum fill_status fill_sid( struct table *table, const struct expr *cond ) const WCHAR *str; struct record_sid *rec; UINT len; + NTSTATUS status; if (!(str = find_sid_str( cond ))) return FILL_STATUS_FAILED; if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED; @@ -3996,10 +3997,12 @@ static enum fill_status fill_sid( struct table *table, const struct expr *cond ) LocalFree( sid ); return FILL_STATUS_FAILED; } - if (LsaLookupSids( handle, 1, &sid, &domain, &name )) + if ((status = LsaLookupSids( handle, 1, &sid, &domain, &name ))) { LocalFree( sid ); LsaClose( handle ); + if (status == STATUS_NONE_MAPPED || status == STATUS_SOME_NOT_MAPPED) + LsaFreeMemory( domain ); return FILL_STATUS_FAILED; }
participants (1)
-
Alexandre Julliard