From bee02df72f1ff02fa11533f666d955511d9c3fbd Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Tue, 20 May 2014 21:46:34 +0200 Subject: [PATCH] WMaker: fix memory leak in wDockTrackWindowLaunch (Coverity #50120 and #50121) As pointed by Coverity, the function 'ProgGetWMClass' always allocates the strings returned in wm_class and wm_instance, so they always must be freed. Signed-off-by: Christophe CURIS --- src/dock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dock.c b/src/dock.c index 6c76d1c1..3fd3dbe1 100644 --- a/src/dock.c +++ b/src/dock.c @@ -3204,8 +3204,11 @@ void wDockTrackWindowLaunch(WDock *dock, Window window) Bool found = False; char *command = NULL; - if (!PropGetWMClass(window, &wm_class, &wm_instance) || (!wm_class && !wm_instance)) + if (!PropGetWMClass(window, &wm_class, &wm_instance)) { + free(wm_class); + free(wm_instance); return; + } command = GetCommandForWindow(window); retry: