Ethereal-dev: Re: [Ethereal-dev] Re: rev 15660: /trunk/plugins/asn1/: packet-asn1.c/trunk/epan

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Tue, 06 Sep 2005 20:29:55 +0200
W. Borgert wrote:


Possibly.  As I don't know much about the issue, I asked on the
Gtk+ mailing list for advice.  I got the answer, that the g_try
functions exactly are for that purpose.  Furthermore, people
told me, that since glib 2.0, the memory management can be
overridden easily(?), using g_mem_set_vtable().

I've done that, but that's not a real solution here. All the functions inside GLib/GTK are not *designed* to get a NULL pointer on return of a malloc call.

You can easily replace the malloc and alike functions (I've done that before to keep some memory statistics), but you still can't just return NULL and hope that all the functions calling g_malloc will behave correctly, most probably a null pointer exception will immediately occur ...

Regards, ULFL