mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +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)
|
static void stopEditItem(WEditMenu * menu, Bool apply)
|
||||||
{
|
{
|
||||||
char *text;
|
|
||||||
|
|
||||||
if (apply) {
|
if (apply) {
|
||||||
text = WMGetTextFieldText(menu->tfield);
|
|
||||||
|
|
||||||
wfree(menu->selectedItem->label);
|
wfree(menu->selectedItem->label);
|
||||||
menu->selectedItem->label = wstrdup(text);
|
menu->selectedItem->label = WMGetTextFieldText(menu->tfield);
|
||||||
|
|
||||||
updateMenuContents(menu);
|
updateMenuContents(menu);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user