The variable iconPath should only checked inside the if block,
because outside is never initialized.
---
 src/application.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/application.c b/src/application.c
index 90ce7e1..ed38be2 100644
--- a/src/application.c
+++ b/src/application.c
@@ -170,9 +170,9 @@ void wApplicationSaveIconPathFor(char *iconPath, char 
*wm_instance, char *wm_cla
 void wApplicationExtractDirPackIcon(WScreen * scr, char *path, char 
*wm_instance, char *wm_class)
 {
        char *iconPath = NULL;
-       if (strstr(path, ".app")) {
-               char *tmp;
+       char *tmp = NULL;
 
+       if (strstr(path, ".app")) {
                tmp = wmalloc(strlen(path) + 16);
 
                if (scr->flags.supports_tiff) {
@@ -191,11 +191,11 @@ void wApplicationExtractDirPackIcon(WScreen * scr, char 
*path, char *wm_instance
 
                if (!iconPath)
                        wfree(tmp);
-       }
 
-       if (iconPath) {
-               wApplicationSaveIconPathFor(iconPath, wm_instance, wm_class);
-               wfree(iconPath);
+               if (iconPath) {
+                       wApplicationSaveIconPathFor(iconPath, wm_instance, 
wm_class);
+                       wfree(iconPath);
+               }
        }
 }
 
-- 
1.7.9.1

>From ceff92051d24b3b4c92a4f0ba48300b366bc180c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?"Rodolfo=20Garc=C3=ADa=20Pe=C3=B1as=20(kix)"?= <[email protected]>
Date: Sat, 14 Apr 2012 12:11:34 +0200
Subject: [PATCH 12/16] WindowMaker: Check iconPath variable only if needed

The variable iconPath should only checked inside the if block,
because outside is never initialized.
---
 src/application.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/application.c b/src/application.c
index 90ce7e1..ed38be2 100644
--- a/src/application.c
+++ b/src/application.c
@@ -170,9 +170,9 @@ void wApplicationSaveIconPathFor(char *iconPath, char *wm_instance, char *wm_cla
 void wApplicationExtractDirPackIcon(WScreen * scr, char *path, char *wm_instance, char *wm_class)
 {
 	char *iconPath = NULL;
-	if (strstr(path, ".app")) {
-		char *tmp;
+	char *tmp = NULL;
 
+	if (strstr(path, ".app")) {
 		tmp = wmalloc(strlen(path) + 16);
 
 		if (scr->flags.supports_tiff) {
@@ -191,11 +191,11 @@ void wApplicationExtractDirPackIcon(WScreen * scr, char *path, char *wm_instance
 
 		if (!iconPath)
 			wfree(tmp);
-	}
 
-	if (iconPath) {
-		wApplicationSaveIconPathFor(iconPath, wm_instance, wm_class);
-		wfree(iconPath);
+		if (iconPath) {
+			wApplicationSaveIconPathFor(iconPath, wm_instance, wm_class);
+			wfree(iconPath);
+		}
 	}
 }
 
-- 
1.7.9.1

Reply via email to