[meta-freescale] [meta-fsl-arm][PATCH v2 5/5] gst-plugins-gl: Fix build of X11 backend

Otavio Salvador otavio at ossystems.com.br
Fri Apr 5 06:41:28 PDT 2013


On Fri, Apr 5, 2013 at 9:03 AM, Philip Craig <phil at blackmoth.com.au> wrote:
> On Fri, Apr 5, 2013 at 9:20 PM, Otavio Salvador <otavio at ossystems.com.br> wrote:
>> On Fri, Apr 5, 2013 at 12:21 AM, Philip Craig <phil at blackmoth.com.au> wrote:
>>> On Fri, Apr 5, 2013 at 1:07 PM, Otavio Salvador <otavio at ossystems.com.br> wrote:
>>>> On Thu, Apr 4, 2013 at 11:25 PM, Philip Craig <phil at blackmoth.com.au> wrote:
>>>> According to GLib doc it does free the resouces
>>>> (https://developer.gnome.org/glib/2.31/glib-Threads.html#g-mutex-clear)
>>>
>>> My understanding is that g_mutex_clear() frees the resources allocated
>>> by g_mutex_init(), but doesn't free the memory allocated by g_new().
>>>
>>> The GLib doc talking about the deprecation suggests to statically
>>> allocate or embed, not to switch to using g_new()
>>> https://developer.gnome.org/glib/2.31/glib-Deprecated-Thread-APIs.html#g-mutex-free
>>
>> It clear states an OR (statically allocated or initialized with
>> g_mutex_init). Checking g_mutex_init it says to use clear when not
>> need anymore: https://developer.gnome.org/glib/2.31/glib-Threads.html#g-mutex-init
>
> The init/clear pair is fine. But the new is missing a matching free.
>
> If you look at the source for g_mutex_clear, you can see if doesn't
> free the mutex, only the p field.
> https://git.gnome.org/browse/glib/tree/glib/gthread-posix.c#n189
>
>> I think it uses a reference counting to dealloc the memory. I am not
>> saying this is the better alternative but the eaiser with small code
>> change. I don't want to diverge too much from FSL code so the
>> maintenance work will  be harder.
>
> If you want a minimal change then you could add a
> -DGLIB_DISABLE_DEPRECATION_WARNINGS flag instead.

Now I got you. Checking it, the rework done for the framebuffer code
is leaking memory as well. I will use the compiler flag and avoid
changing this code for now.

Thanks by spotting it :-)

--
Otavio Salvador                             O.S. Systems
E-mail: otavio at ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br



More information about the meta-freescale mailing list