1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 14:42:29 +01:00

WPrefs: fix memory leak when saving window handling settings (Coverity #50158)

As pointed by Coverity, the functions WMCreatePLString return a newly
allocated WMPropList, which must be released when not needed anymore.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-05-31 19:58:47 +02:00
committed by Carlos R. Mafra
parent f4f96a8fb7
commit 8eb6c82231

View File

@@ -222,7 +222,8 @@ static void showData(_Panel * panel)
static void storeData(_Panel * panel)
{
WMPropList *arr;
char x[16], y[16];
WMPropList *x, *y;
char buf[16];
SetBoolForKey(WMGetButtonSelected(panel->miconB), "NoWindowOverIcons");
SetBoolForKey(WMGetButtonSelected(panel->mdockB), "NoWindowOverDock");
@@ -234,9 +235,13 @@ static void storeData(_Panel * panel)
SetBoolForKey(WMGetButtonSelected(panel->tranB), "OpenTransientOnOwnerWorkspace");
SetStringForKey(placements[WMGetPopUpButtonSelectedItem(panel->placP)], "WindowPlacement");
sprintf(x, "%i", WMGetSliderValue(panel->hsli));
sprintf(y, "%i", WMGetSliderValue(panel->vsli));
arr = WMCreatePLArray(WMCreatePLString(x), WMCreatePLString(y), NULL);
sprintf(buf, "%i", WMGetSliderValue(panel->hsli));
x = WMCreatePLString(buf);
sprintf(buf, "%i", WMGetSliderValue(panel->vsli));
y = WMCreatePLString(buf);
arr = WMCreatePLArray(x, y, NULL);
WMReleasePropList(x);
WMReleasePropList(y);
SetObjectForKey(arr, "WindowPlaceOrigin");
SetIntegerForKey(WMGetSliderValue(panel->resS), "EdgeResistance");