Bug 169549 - Memory leak in create_menu() (menu.c)
Memory leak in create_menu() (menu.c)
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: mc (Show other bugs)
4
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jindrich Novy
http://mail.gnome.org/archives/mc-dev...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-09-29 11:44 EDT by Marcin Garski
Modified: 2013-07-02 19:09 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-09-29 13:56:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Marcin Garski 2005-09-29 11:44:48 EDT
mc-4.6.1a-0.12.FC4

Valgrind report:
==7377== 13 bytes in 1 blocks are definitely lost in loss record 18 of 60
==7377==    at 0x1B909222: malloc (vg_replace_malloc.c:130)
==7377==    by 0x1B954ADF: g_malloc (in /usr/lib/libglib-2.0.so.0.600.6)
==7377==    by 0x1B966DAD: g_strdup (in /usr/lib/libglib-2.0.so.0.600.6)
==7377==    by 0x807D2E1: create_menu (menu.c:62)
==7377==    by 0x807ABE9: init_menu (main.c:939)
==7377==    by 0x807B253: ??? (main.c:1391)
==7377==    by 0x807C432: main (main.c:1762)

Leak is caused by UTF-8 patch.

As I see in create_menu() there is line (62) :
menu->name = g_strdup (name);

and then in line (145) you do:

menu->name = g_strdup (name);

But first name isn't free anywhere. So memory allocated by first g_strdup() is lost.

Also patch add IMHO redundant line:
+    menu_scan_hotkey (menu);

Probably fix for this would be to remove:
menu->name = g_strdup (name);
menu_scan_hotkey(menu);
lines above "menu->start_x = 0;".
Comment 1 Jindrich Novy 2005-09-29 13:56:24 EDT
Ok, fixed. Thanks.

Note You need to log in before you can comment on or make changes to this bug.