From: Christophe CURIS <[email protected]>

As pointed by Coverity, the string returned by 'WMGetTextFieldText' is
allocated dynamically, so it must be freed when not needed anymore.

Signed-off-by: Christophe CURIS <[email protected]>
---
 WPrefs.app/Docks.c         | 6 +++++-
 WPrefs.app/Focus.c         | 1 +
 WPrefs.app/MouseSettings.c | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/WPrefs.app/Docks.c b/WPrefs.app/Docks.c
index 7d54f30..2a5265a 100644
--- a/WPrefs.app/Docks.c
+++ b/WPrefs.app/Docks.c
@@ -292,7 +292,11 @@ static void storeData(_Panel *panel)
        int i;
        for (i = 0; i < 4; i++)
        {
-               SetStringForKey(WMGetTextFieldText(panel->autoDelayT[i]), 
auto_delay[i].key);
+               char *str;
+
+               str = WMGetTextFieldText(panel->autoDelayT[i]);
+               SetStringForKey(str, auto_delay[i].key);
+               wfree(str);
        }
        for (i = 0; i < 3; i++)
        {
diff --git a/WPrefs.app/Focus.c b/WPrefs.app/Focus.c
index 3ee8ec9..ea4b20f 100644
--- a/WPrefs.app/Focus.c
+++ b/WPrefs.app/Focus.c
@@ -138,6 +138,7 @@ static void storeData(_Panel * panel)
        if (sscanf(str, "%i", &i) != 1)
                i = 0;
        SetIntegerForKey(i, "RaiseDelay");
+       free(str);
 
        SetBoolForKey(WMGetButtonSelected(panel->ignB), "IgnoreFocusClick");
        SetBoolForKey(WMGetButtonSelected(panel->newB), "AutoFocus");
diff --git a/WPrefs.app/MouseSettings.c b/WPrefs.app/MouseSettings.c
index cb767e6..741bf97 100644
--- a/WPrefs.app/MouseSettings.c
+++ b/WPrefs.app/MouseSettings.c
@@ -750,6 +750,7 @@ static void storeData(_Panel * panel)
        tmp = WMGetTextFieldText(panel->ddelaT);
        if (sscanf(tmp, "%i", &i) == 1 && i > 0)
                SetIntegerForKey(i, "DoubleClickTime");
+       wfree(tmp);
 
        SetBoolForKey(WMGetButtonSelected(panel->disaB), 
"DisableWSMouseActions");
 
-- 
1.9.2


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

Reply via email to