From 3250826215b0d346ef47e46008450c1c85dba067 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Mon, 16 Jun 2014 20:15:24 +0200 Subject: [PATCH] util: fix leaks in wmsetbg's changeTextureForWorkspace (Coverity #50169) As pointed by Coverity, some locally created PropList objects are not freed when the function returns. The truth is their refCount is 1 more than what they should be, but that's more than what Coverity can detect today. This patch adds the appropriate release calls when they are not needed anymore, which will actually not free them but get their refCount right so they will be freed as soon as the PropList in which they are used are released. Signed-off-by: Christophe CURIS --- util/wmsetbg.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/wmsetbg.c b/util/wmsetbg.c index 41e1d116..6ba2a8a5 100644 --- a/util/wmsetbg.c +++ b/util/wmsetbg.c @@ -1196,6 +1196,8 @@ static void changeTextureForWorkspace(const char *domain, char *texture, int wor WMAddToPLArray(array, empty); } WMAddToPLArray(array, val); + + WMReleasePropList(empty); } else { WMDeleteFromPLArray(array, workspace); WMInsertInPLArray(array, workspace, val); @@ -1203,6 +1205,8 @@ static void changeTextureForWorkspace(const char *domain, char *texture, int wor value = WMGetPropListDescription(array, False); updateDomain(domain, "WorkspaceSpecificBack", value); + + WMReleasePropList(array); } int main(int argc, char **argv)