Wireshark-dev: Re: [Wireshark-dev] mixed strdup() with g_free()

From: Jeff Morriss <jeff.morriss.ws@xxxxxxxxx>
Date: Tue, 15 Apr 2008 08:57:25 -0400


Ulf Lamping wrote:
Hi!

In SVN25037 I've replaced some strdup() with calls to g_strdup(). If you want to free the allocated memory later with g_free(), this doesn't work (at least) on MSVC2005 builds! However, this is unclean and potentially dangerous on other systems as well - AFAIK GLib makes no guarantees what will happen.

I've fixed some obvious cases, but there are more strdup() calls in the code that are also potentially unsafe, how to continue here?

Makes sense to just ban strdup() as we generally ban non-glib malloc and free too.