From: Christophe CURIS <[email protected]>

As pointed by Coverity, the function 'WMGetTextFieldText' already allocates
memory for its return string, so it is not necessary to wstrdup it.

Signed-off-by: Christophe CURIS <[email protected]>
---
 WPrefs.app/editmenu.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/WPrefs.app/editmenu.c b/WPrefs.app/editmenu.c
index c3cf296..7a9b29b 100644
--- a/WPrefs.app/editmenu.c
+++ b/WPrefs.app/editmenu.c
@@ -809,13 +809,9 @@ static void handleEvents(XEvent * event, void *data)
 
 static void stopEditItem(WEditMenu * menu, Bool apply)
 {
-       char *text;
-
        if (apply) {
-               text = WMGetTextFieldText(menu->tfield);
-
                wfree(menu->selectedItem->label);
-               menu->selectedItem->label = wstrdup(text);
+               menu->selectedItem->label = WMGetTextFieldText(menu->tfield);
 
                updateMenuContents(menu);
 
-- 
1.9.2


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

Reply via email to