This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

intl patches (4)


This fixes two memory leaks on systems that don't have alloca(). No effect
inside glibc.


2002-07-13  Bruno Haible  <bruno@clisp.org>

	* intl/dcigettext.c (freea): New macro.
	(FREE_BLOCKS): Free also the registered blocks.
	(DCIGETTEXT): Free the 'search' variable.
	Reported by Andreas Fischer <a.fischer@asentics.de>.

--- glibc-20021126/intl/dcigettext.c.bak	Mon Nov  4 13:25:25 2002
+++ glibc-20021126/intl/dcigettext.c	Wed Dec 11 15:19:01 2002
@@ -280,6 +294,7 @@
    some additional code emulating it.  */
 #ifdef HAVE_ALLOCA
 /* Nothing has to be done.  */
+# define freea(p) /* nothing */
 # define ADD_BLOCK(list, address) /* nothing */
 # define FREE_BLOCKS(list) /* nothing */
 #else
@@ -304,11 +319,13 @@
     while (list != NULL) {						      \
       struct block_list *old = list;					      \
       list = list->next;						      \
+      free (old->address);						      \
       free (old);							      \
     }									      \
   } while (0)
 # undef alloca
 # define alloca(size) (malloc (size))
+# define freea(p) free (p)
 #endif	/* have alloca */
 
 
@@ -425,6 +454,7 @@
   search->category = category;
 
   foundp = (struct known_translation_t **) tfind (search, &root, transcmp);
+  freea (search);
   if (foundp != NULL && (*foundp)->counter == _nl_msg_cat_cntr)
     {
       /* Now deal with plural.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]