Patch for memory leak



Here's a patch+README for a memory leak I found. (Also uploaded to
ftp.gimp.org)

/August.
--------
(Simple patch that adds two calls to XFree() in gdk_mbstowcs, in
gdkim.c)

This memory leak appears on Solaris, and (I guess) anywhere else where
the gdk_set_locale function ends up setting gdk_use_mb to 1.

It does _not_ show up on a Linux amchine I tried it on.

Calls to gtk_label_set_text() triggers it. (Resulting in stuff like 30MB
gnomepager_applets.)
-------

--- gdkim.c.orig	Thu Mar 11 00:24:40 1999
+++ gdkim.c	Thu Mar 11 00:33:00 1999
@@ -1565,8 +1565,10 @@
 	  != Success)
 	{
 	  /* InvalidChar */
+	  XFree(tpr.value);
 	  return -1;
 	}
+      XFree(tpr.value);
       if (num_wstrs == 0)
 	return 0;
       wstr_src = wstrs[0];

/August.
-- 
Wrong on most accounts.  const Foo *foo; and Foo const *foo; mean the same: foo
being a pointer to const Foo.  const Foo const *foo; would mean the same but is
illegal (double const).  You are confusing this with Foo * const foo; and const
Foo * const foo; respectively. -David Kastrup, comp.os.linux.development.system



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