]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix memory leak.
authorDaiki Ueno <ueno@gnu.org>
Thu, 3 Jan 2013 05:18:38 +0000 (14:18 +0900)
committerDaiki Ueno <ueno@gnu.org>
Thu, 3 Jan 2013 05:18:38 +0000 (14:18 +0900)
gettext-tools/src/ChangeLog
gettext-tools/src/xgettext.c

index 2ab9c530aeeaaf775cab338c9576dea17353ae66..2faff73ad2404d4a82dc0ce1d2b04d8b18ba4a8a 100644 (file)
@@ -1,3 +1,7 @@
+2013-01-03  Daiki Ueno  <ueno@gnu.org>
+
+       * xgettext.c (construct_header): Fix memory leak.
+
 2012-12-25  Daiki Ueno  <ueno@gnu.org>
 
        * gettext-0.18.2 released.
index eb3271f52e8dc205d6d418820d0796bbe02008e0..90184b7f768d04e1df0f37ef89a9c4ef6ed7e616 100644 (file)
@@ -3000,6 +3000,7 @@ construct_header ()
   char *timestring;
   message_ty *mp;
   char *msgstr;
+  char *comment;
   static lex_pos_ty pos = { __FILE__, __LINE__ };
 
   if (package_name != NULL)
@@ -3043,18 +3044,20 @@ Content-Transfer-Encoding: 8bit\n",
 
   mp = message_alloc (NULL, "", NULL, msgstr, strlen (msgstr) + 1, &pos);
 
-  message_comment_append (mp,
-                          copyright_holder[0] != '\0'
-                          ? xasprintf ("\
+  if (copyright_holder[0] != '\0')
+    comment = xasprintf ("\
 SOME DESCRIPTIVE TITLE.\n\
 Copyright (C) YEAR %s\n\
 This file is distributed under the same license as the PACKAGE package.\n\
 FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.\n",
-                                       copyright_holder)
-                          : "\
+                        copyright_holder);
+  else
+    comment = xstrdup ("\
 SOME DESCRIPTIVE TITLE.\n\
 This file is put in the public domain.\n\
 FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.\n");
+  message_comment_append (mp, comment);
+  free (comment);
 
   mp->is_fuzzy = true;