[Mono-bugs] [Bug 574773] New: Memory leak in mono_path_resolve_symlinks usage of g_strsplit

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jan 28 10:50:20 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=574773

http://bugzilla.novell.com/show_bug.cgi?id=574773#c0


           Summary: Memory leak in mono_path_resolve_symlinks usage of
                    g_strsplit
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.6.x
          Platform: Other
        OS/Version: Mac OS X 10.6
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: duane at wandless.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


I was looking for memory leaks in my code using MallocStackLogging and the
leaks command line utility.  I found a lot of references like this:

Leak: 0xc19e00  size=16  zone: DefaultMallocZone_0xbe7000       string 'Debug'
        Call stack: [thread 0xa0459500]: | 0x1 | start | main | InitMono |
mono_jit_init | mini_init | mono_init_from_assembly | mono_init_internal |
get_runtimes_from_exe | mono_image_open | mono_image_open_full |
do_mono_image_open | mono_path_resolve_symlinks | g_strsplit | g_strndup |
g_malloc | malloc | malloc_zone_malloc 
Leak: 0xc1a810  size=16  zone: DefaultMallocZone_0xbe7000       string
'Contents'
        Call stack: [thread 0xa0459500]: | 0x1 | start | main | InitMono |
mono_jit_init | mini_init | mono_init_from_assembly | mono_init_internal |
get_runtimes_from_exe | mono_image_open | mono_image_open_full |
do_mono_image_open | mono_path_resolve_symlinks | g_strsplit | g_strndup |
g_malloc | malloc | malloc_zone_malloc 

In looking at utils/mono-path.c, the code calls g_strsplit() then calls
g_free().

According to the documentation on g_strsplit, g_strfreev() should be called.

I did a quick grep for g_strsplit there are other usages where no attempt is
made to free the returned the array of strings.

These leaks may be minor but the add up nonetheless.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list