summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 4c6e917..43b74a8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -709,6 +709,7 @@ int parseArguments(int argc, const char **argv, CCCommand *cmd, int *arg, char *
poptSetOtherOptionHelp(optCon, "command");
if (argc < 2) {
poptPrintUsage(optCon, stderr, 0);
+ poptFreeContext(optCon);
return EXIT_SUCCESS;
}
/* Now do options processing, get portname */
@@ -756,17 +757,18 @@ int parseArguments(int argc, const char **argv, CCCommand *cmd, int *arg, char *
}
}
- poptFreeContext(optCon);
-
if (serial)
snprintf(args, argsLen, "%s", serial);
free(serial);
if (c < -1) {
fprintf(stderr, "%s: %s\n", poptBadOption(optCon, POPT_BADOPTION_NOALIAS), poptStrerror(c));
+ poptFreeContext(optCon);
return EXIT_FAILURE;
}
+ poptFreeContext(optCon);
+
return EXIT_SUCCESS;
}