From 8202587953fed29a3820564df7da5e486536e368 Mon Sep 17 00:00:00 2001 From: akallabeth Date: Mon, 13 Jan 2025 10:07:31 +0100 Subject: [PATCH] [winpr,wlog] fix possible NULL dereference --- winpr/libwinpr/utils/wlog/wlog.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/winpr/libwinpr/utils/wlog/wlog.c b/winpr/libwinpr/utils/wlog/wlog.c index 91d7a3c71..e8a88373e 100644 --- a/winpr/libwinpr/utils/wlog/wlog.c +++ b/winpr/libwinpr/utils/wlog/wlog.c @@ -919,7 +919,10 @@ void WLog_Free(wLog* log) } free(log->Name); - free(log->Names[0]); + + /* The first element in this array is allocated, the rest are indices into this variable */ + if (log->Names) + free(log->Names[0]); free((void*)log->Names); free((void*)log->Children); DeleteCriticalSection(&log->lock);