1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-11 12:05:06 -05:00

fix memory leak in case of memory problems

CID 16 by coverity.com scan
This commit is contained in:
Daniel Stenberg 2007-03-31 21:20:16 +00:00
parent dc2ea33e32
commit 5796c7b132

View File

@ -4671,9 +4671,14 @@ static int create_dir_hierarchy(const char *outfile)
int error; int error;
outdup = strdup(outfile); outdup = strdup(outfile);
dirbuildup = malloc(sizeof(char) * strlen(outfile)); if(!outdup)
if(!dirbuildup)
return -1; return -1;
dirbuildup = malloc(sizeof(char) * strlen(outfile));
if(!dirbuildup) {
free(outdup);
return -1;
}
dirbuildup[0] = '\0'; dirbuildup[0] = '\0';
tempdir = strtok(outdup, DIR_CHAR); tempdir = strtok(outdup, DIR_CHAR);