Re: [gtk-vnc-devel] crash on disconnect



On Tue, Apr 15, 2008 at 10:18:47AM -0300, Jorge Pereira wrote:
> so,
> 
> i think that better idea, it's check if data is equals NULL.
> 
> eg:
> 
> if(priv->gl_tex_data != NULL)
> g_free(priv->gl_tex_data);


No, this is redundant & clutters up the code

Both free() and g_free() explicitly allows you to pass NULL as their arg 
and will be a no-op in that scenario. This avoids having to fill your
code with lots of if (...) statements.

http://library.gnome.org/devel/glib/stable/glib-Memory-Allocation.html#g-free

Dan.
-- 
|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




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