summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/libsi18n/makstrdb.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/libsi18n/makstrdb.c b/lib/libsi18n/makstrdb.c
index c96c4d54..2ced26e9 100644
--- a/lib/libsi18n/makstrdb.c
+++ b/lib/libsi18n/makstrdb.c
@@ -160,13 +160,21 @@ XP_MakeStringProperties(void)
int j;
char* LibraryName;
RESOURCE_TABLE* table;
- FILE *hresfile;
+ FILE *hresfile = NULL;
char buffer[2000];
char *src, *dest;
- char *dbfile;
+ char *dbfile = NULL;
+ int rc = 0;
/* Creating database */
dbfile = (char *) malloc (strlen(DATABASE_NAME) + 20);
+
+ if (dbfile==NULL) {
+ printf("Out of memory\n");
+ rc = 1;
+ goto done;
+ }
+
strcpy(dbfile, DATABASE_NAME);
strcat(dbfile, ".properties");
@@ -174,7 +182,8 @@ XP_MakeStringProperties(void)
if (hresfile==NULL) {
printf("Error creating properties file %s\n",DATABASE_NAME);
- return 1;
+ rc = 1;
+ goto done;
}
j = 0;
@@ -213,8 +222,10 @@ XP_MakeStringProperties(void)
}
}
- fclose(hresfile);
- return 0;
+done:
+ if (hresfile) fclose(hresfile);
+ if (dbfile) free(dbfile);
+ return rc;
}