mirror of
https://github.com/gryf/wmaker.git
synced 2026-10-06 00:50:34 +02:00
WPrefs: fix memory leak when editing the label of a menu (Coverity #50130)
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 <christophe.curis@free.fr>
This commit is contained in:
1 parent
c54bb11ee9
commit
27a2259934
1 file changed
+1
-5
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user