aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-03-31 21:20:16 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-03-31 21:20:16 +0000
commit5796c7b1322375da0fa15620ca1a9c825df0ab01 (patch)
treec6a66827a4293cb73e3b2e551af64e199a9fe0f5
parentdc2ea33e32ba9aeecdcd33c0541a9e33a85774ba (diff)
fix memory leak in case of memory problems
CID 16 by coverity.com scan
-rw-r--r--src/main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index cfec4a307..5a953519d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4671,9 +4671,14 @@ static int create_dir_hierarchy(const char *outfile)
int error;
outdup = strdup(outfile);
+ if(!outdup)
+ return -1;
+
dirbuildup = malloc(sizeof(char) * strlen(outfile));
- if(!dirbuildup)
+ if(!dirbuildup) {
+ free(outdup);
return -1;
+ }
dirbuildup[0] = '\0';
tempdir = strtok(outdup, DIR_CHAR);