diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-05-10 14:45:11 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-05-10 14:45:11 +0000 |
commit | 7a35fb5403d032cdd91d344c557c7de09745d696 (patch) | |
tree | c2266d145e03897158098ed24a0f70a0a657feb5 /src | |
parent | 63f97b38eb3a86615e7cb92e70f91cf14d69945a (diff) |
slightly better dealing of bad mem situations
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c index 1c5bb71cf..6cc264b24 100644 --- a/src/main.c +++ b/src/main.c @@ -769,6 +769,10 @@ static int formparse(char *input, /* Allocate the contents */ contents = strdup(contp+1); + if(!contents) { + fprintf(stderr, "out of memory\n"); + return 1; + } contp = contents; if('@' == contp[0]) { @@ -2927,6 +2931,8 @@ operate(struct Configurable *config, int argc, char *argv[]) (config->errors?config->errors:stderr):NULL); if(res != CURLE_OK) { clean_getout(config); + if(outfiles) + free(outfiles); break; } } @@ -3021,10 +3027,9 @@ operate(struct Configurable *config, int argc, char *argv[]) /* Create the directory hierarchy, if not pre-existant to a multiple file output call */ - if(config->create_dirs) - if (-1 == create_dir_hierarchy(outfile)) { - return CURLE_WRITE_ERROR; - } + if(config->create_dirs && + (-1 == create_dir_hierarchy(outfile))) + return CURLE_WRITE_ERROR; if(config->resume_from_current) { /* We're told to continue from where we are now. Get the |