]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix memory leaks when there is no alloca().
authorBruno Haible <bruno@clisp.org>
Mon, 15 Jul 2002 12:40:17 +0000 (12:40 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:08:37 +0000 (12:08 +0200)
intl/ChangeLog
intl/dcigettext.c

index 0a39222a54913f262250299bd9c59f3f0cdd5785..9ea3f048d18079fc818848e14f9a00a15e04f7a8 100644 (file)
@@ -1,3 +1,10 @@
+2002-07-13  Bruno Haible  <bruno@clisp.org>
+
+       * 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>.
+
 2002-06-13  Bruno Haible  <bruno@clisp.org>
 
        Make absolute pathnames inside $LANGUAGE work.
index b5bf3fb5dc1b2bd354c68c4555d5c4162a182ec9..bec5dd33e3d5a93e37421d5ada2137aee9e3c3c0 100644 (file)
@@ -306,6 +306,7 @@ static const char *guess_category_value PARAMS ((int category,
    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
@@ -330,11 +331,13 @@ struct block_list
     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 */
 
 
@@ -460,6 +463,7 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
   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.  */