From: Christophe CURIS <[email protected]>

As pointed by Coverity, there is one case where the string returned by
WMGetTextFieldText could be left allocated.

Signed-off-by: Christophe CURIS <[email protected]>
---
 src/winspector.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/winspector.c b/src/winspector.c
index 679c56f..f1289dd 100644
--- a/src/winspector.c
+++ b/src/winspector.c
@@ -488,11 +488,13 @@ static void saveSettings(WMWidget *button, void 
*client_data)
 
        /* The icon filename (if exists) */
        icon_file = WMGetTextFieldText(panel->fileText);
-       if ((icon_file) && (icon_file[0] != 0)) {
-               value = WMCreatePLString(icon_file);
-               different |= insertAttribute(dict, winDic, AIcon, value, flags);
-               different2 |= insertAttribute(dict, appDic, AIcon, value, 
flags);
-               WMReleasePropList(value);
+       if (icon_file != NULL) {
+               if (icon_file[0] != '\0') {
+                       value = WMCreatePLString(icon_file);
+                       different |= insertAttribute(dict, winDic, AIcon, 
value, flags);
+                       different2 |= insertAttribute(dict, appDic, AIcon, 
value, flags);
+                       WMReleasePropList(value);
+               }
                wfree(icon_file);
        }
 
-- 
1.9.2


-- 
To unsubscribe, send mail to [email protected].

Reply via email to