GNOME Bugzilla – Bug 669334
fix memory leak in bookmark file parser
Last modified: 2012-02-04 15:10:07 UTC
fix memory leak in g_bookmark_file_parse(). ==605== 1,315 (104 direct, 1,211 indirect) bytes in 1 blocks are definitely lost in loss record 111 of 119 ==605== at 0x4028876: malloc (vg_replace_malloc.c:236) ==605== by 0x407B62A: standard_malloc (gmem.c:85) ==605== by 0x407B9D2: g_malloc (gmem.c:159) ==605== by 0x4078F27: g_markup_parse_context_new (gmarkup.c:228) ==605== by 0x404BC1F: g_bookmark_file_load_from_data (gbookmarkfile.c:1441) ==605== by 0x404BDDB: g_bookmark_file_load_from_file (gbookmarkfile.c:1735) ==605== by 0xBED67E9F: ??? ==605== ==605== 19,682 (1,664 direct, 18,018 indirect) bytes in 16 blocks are definitely lost in loss record 119 of 119 ==605== at 0x4028876: malloc (vg_replace_malloc.c:236) ==605== by 0x407B62A: standard_malloc (gmem.c:85) ==605== by 0x407B9D2: g_malloc (gmem.c:159) ==605== by 0x4078F27: g_markup_parse_context_new (gmarkup.c:228) ==605== by 0x404BC1F: g_bookmark_file_load_from_data (gbookmarkfile.c:1441) ==605== by 0x404BDDB: g_bookmark_file_load_from_file (gbookmarkfile.c:1735) ==605== by 0x4065C4F: g_str_equal (ghash.c:1697) ==605== by 0x4065C1F: ??? (ghash.c:1668)
Created attachment 206708 [details] [review] fix a memory leak please review.
Review of attachment 206708 [details] [review]: Looks correct, though you could also change this function to single-exit-and-free style (since it would be trivial to do so) while you have the patient open. Do you have GNOME commit access?
thank you. would consider your suggestion. nope, don't have commit access.
Created attachment 206755 [details] [review] single exit with free please review.
Review of attachment 206755 [details] [review]: ::: glib/gbookmarkfile.c @@ +1460,3 @@ + } + + if (context) This if (context) looks unnecessary. I've gone ahead and removed it, and pushed your patch. Thanks! Now that I look at this code more closely though, I am confused why we are allocating separate "parse_error" and "end_error". Emmanuele?