Memory leak in create_menu() (menu.c)



Hello

I start playing with valgrind (so please don't bite me if this is my error (-: ), and I've found this leak (just run mc and press F10):

==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)

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.
Am I right?

mc-4.6.1a-0.12.FC4
--
Marcin Garski



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]