mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-18 20:10:29 +01: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:
committed by
Carlos R. Mafra
parent
c54bb11ee9
commit
27a2259934
@@ -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