summaryrefslogtreecommitdiff
path: root/locale/po2strings.c
diff options
context:
space:
mode:
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2012-03-30 05:59:14 +0000
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2012-03-30 05:59:14 +0000
commit82cc1f9ac32564e92bfbbe7a1de416f4ebcc8584 (patch)
treeaf43377451e06dac91d6639e35b1b5bf41d14d4e /locale/po2strings.c
parent3e7fe0ca760ad0054cf5c9ec7c90ca415cf6eb06 (diff)
Merge changes from CUPS 1.6svn-r10390.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@3755 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'locale/po2strings.c')
-rw-r--r--locale/po2strings.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/locale/po2strings.c b/locale/po2strings.c
index 97f9cc337..0b7d1f32f 100644
--- a/locale/po2strings.c
+++ b/locale/po2strings.c
@@ -3,7 +3,7 @@
*
* Convert a GNU gettext .po file to an Apple .strings file.
*
- * Copyright 2007-2010 by Apple Inc.
+ * Copyright 2007-2012 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -175,7 +175,7 @@ main(int argc, /* I - Number of command-line args */
/*
* Find start of value...
*/
-
+
if ((ptr = strchr(s, '\"')) == NULL)
continue;
@@ -196,15 +196,18 @@ main(int argc, /* I - Number of command-line args */
if (*msgid)
cupsFilePrintf(strings, "\"%s\" = \"%s\";\n", msgid,
(use_msgid || !*msgstr) ? msgid : msgstr);
+ }
+ if (msgid)
free(msgid);
+
+ if (msgstr)
free(msgstr);
- }
msgid = strdup(ptr);
msgstr = NULL;
}
- else if (s[0] == '\"' )
+ else if (s[0] == '\"' && (msgid || msgstr))
{
/*
* Append to current string...
@@ -215,6 +218,9 @@ main(int argc, /* I - Number of command-line args */
if ((temp = realloc(msgstr ? msgstr : msgid,
length + strlen(ptr) + 1)) == NULL)
{
+ free(msgid);
+ if (msgstr)
+ free(msgstr);
perror("Unable to allocate string");
return (1);
}
@@ -250,8 +256,12 @@ main(int argc, /* I - Number of command-line args */
* Set the string...
*/
+ if (msgstr)
+ free(msgstr);
+
if ((msgstr = strdup(ptr)) == NULL)
{
+ free(msgid);
perror("Unable to allocate msgstr");
return (1);
}
@@ -264,10 +274,13 @@ main(int argc, /* I - Number of command-line args */
if (*msgid)
cupsFilePrintf(strings, "\"%s\" = \"%s\";\n", msgid,
(use_msgid || !*msgstr) ? msgid : msgstr);
+ }
+ if (msgid)
free(msgid);
+
+ if (msgstr)
free(msgstr);
- }
cupsFileClose(po);
cupsFileClose(strings);