Yes, the current usage of a_dialog_new_track() can create a small memory leak 
when asking for new names - as it will only free the name returned by that 
dialog. And the suggested name is never freed.

Thank you once again for noticing.

I believe I have fixed it locally and I'll update code repositories soon.

--
Be Seeing You - Rob.
If at first you don't succeed,
then skydiving isn't for you.

________________________________________
From: Kamil Ignacak <kamil.igna...@gmail.com>
Sent: 20 July 2018 16:33:14
To: viking-devel
Subject: [Viking-devel] Possible memory leak through a_dialog_new_track()

Hi!

I think that I have spotted a possible memory leak. Can you please take a look 
and verify?

Viking is using a_dialog_new_track() function in two places. In both places the 
second argument passed to the function is a freshly allocated string. The 
function doesn't deallocate the string explicitly and - if I understand 
correctly - the string is not deallocated by gtk widgets used in the function 
either.

The code calling a_dialog_new_track() does deallocate a string, but it may be a 
different string than the one passed as argument to function:

gchar *name = trw_layer_new_unique_sublayer_name(vtl, ..., ...);
if (a_vik_get_ask_for_create_track_name()) {
    /* These two 'name' pointers may have different values. */
    name = a_dialog_new_track(vtl, name, FALSE);
    if (!name)
        return FALSE;
    }
    new_track_create_common( vtl, name);
    g_free(name);


Best regards,
Kamil


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/

Reply via email to