aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ipcalc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ipcalc.c b/src/ipcalc.c
index f90ff456..468a037c 100644
--- a/src/ipcalc.c
+++ b/src/ipcalc.c
@@ -296,7 +296,7 @@ int main(int argc, const char **argv) {
}
tmp = NULL;
for (; i>0; i--) {
- tmp = malloc(strlen(ipStr + 3));
+ tmp = malloc(strlen(ipStr) + 3);
sprintf(tmp,"%s.0",ipStr);
ipStr = tmp;
}
@@ -308,13 +308,14 @@ int main(int argc, const char **argv) {
return 1;
}
- poptFreeContext(optCon);
if (!(showNetmask|showPrefix|showBroadcast|showNetwork|showHostname)) {
poptPrintHelp(optCon, stderr, 0);
return 1;
}
+ poptFreeContext(optCon);
+
/* we know what we want to display now, so display it. */
if (showNetmask) {