Wireshark mailing list archives

Re: [Wireshark-commits] rev 36988: /trunk/ /trunk/epan/dissectors/: packet-iwarp-mpa.c packet-spnego.c packet-ssl-utils.c /trunk/: tap-iostat.c


From: Jakub Zawadzki <darkjames-ws () darkjames pl>
Date: Thu, 5 May 2011 08:51:21 +0200

On Wed, May 04, 2011 at 04:40:12PM -0600, Stephen Fisher wrote:
On Wed, May 04, 2011 at 09:19:08PM +0000, darkjames () wireshark org wrote:

Log:
 XXX, should this code use g_try_malloc instead?

is that inside GTK+ and GLib, 
they still use g_malloc, so we can't totally eliminate the 
possibilty of Wireshark being aborted when out of memory.

Hmm, we could set our own allocator (g_mem_set_vtable()),
and THROW OutOfMemoryError (instead of aborting)

for example vtab.malloc routine:
#v+
static gpointer
ws_malloc(gsize n_bytes)
{
  gpointer ptr = malloc(n_bytes);
  if (!ptr)
    THROW(OutOfMemoryError);
  return ptr;
}
#v-
not tested (I don't have OOM problems ;-))
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: