aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-01-08 15:02:58 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-01-08 15:02:58 +0000
commit2cac4a9c727e4d033fe4e6bf34558a5664e11b6c (patch)
tree32fe484a3e444fae9f8ae74a4448d38e008d4556 /src
parent39e939a5079d39998558fc862b075372d4ed44c3 (diff)
better cleanup when existing due to bad usage
Diffstat (limited to 'src')
-rw-r--r--src/main.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index fa49688d8..47087754a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -443,6 +443,23 @@ static char *file2memory(FILE *file, long *size)
return NULL; /* no string */
}
+void clean_getout(struct Configurable *config)
+{
+ struct getout *node=config->url_list;
+ struct getout *next;
+
+ while(node) {
+ next = node->next;
+ if(node->url)
+ free(node->url);
+ if(node->outfile)
+ free(node->outfile);
+ free(node);
+
+ node = next; /* GOTO next */
+ }
+}
+
struct getout *new_getout(struct Configurable *config)
{
struct getout *node =malloc(sizeof(struct getout));
@@ -1480,6 +1497,7 @@ operate(struct Configurable *config, int argc, char *argv[])
/* no text */
break;
}
+ clean_getout(config);
return CURLE_FAILED_INIT;
}
@@ -1530,7 +1548,7 @@ operate(struct Configurable *config, int argc, char *argv[])
/* save outfile pattern before expansion */
outfiles = urlnode->outfile?strdup(urlnode->outfile):NULL;
- if (!outfiles || strequal(outfiles, "-") && urlnum > 1) {
+ if ((!outfiles || strequal(outfiles, "-")) && urlnum > 1) {
/* multiple files extracted to stdout, insert separators! */
separator = 1;
}