From: Christophe CURIS <christophe.cu...@free.fr>

The name of the color is stored in a newly created PLString which leaks.
This is due to the fact that they are created with a refCount of 1, then
the PLArray in which they are placed increments that count, so at list
destruction the count would return to 1 instead of 0, meaning the
PLString won't be freed.

This patch properly calls  WMReleasePropList after addition to the list, so
that the count goes back to 1, which means it will be automatically freed
when the PLArray will be released.

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 WPrefs.app/Appearance.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/WPrefs.app/Appearance.c b/WPrefs.app/Appearance.c
index 7e22dec..25f1422 100644
--- a/WPrefs.app/Appearance.c
+++ b/WPrefs.app/Appearance.c
@@ -2222,11 +2222,14 @@ static void prepareForClose(_Panel * panel)
        for (i = 0; i < wlengthof(sample_colors); i++) {
                WMColor *color;
                char *str;
+               WMPropList *pl_color;
 
                color = WMGetColorWellColor(panel->sampW[i]);
 
                str = WMGetColorRGBDescription(color);
-               WMAddToPLArray(textureList, WMCreatePLString(str));
+               pl_color = WMCreatePLString(str);
+               WMAddToPLArray(textureList, pl_color);
+               WMReleasePropList(pl_color);
                wfree(str);
        }
        WMSetUDObjectForKey(udb, textureList, "ColorList");
-- 
2.1.1


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to