aboutsummaryrefslogtreecommitdiffstats
path: root/src/ipcalc.c
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2003-09-04 01:28:47 +0000
committerBill Nottingham <notting@redhat.com>2003-09-04 01:28:47 +0000
commitac574862cc95b534223fd468a0549c04b9459279 (patch)
treefa4c4c4ef6b8539bf948f9cb99273ea4b3dc6e75 /src/ipcalc.c
parentc321d9b8c3e29061a89c78eb829522172e7300ef (diff)
downloadinitscripts-ac574862cc95b534223fd468a0549c04b9459279.tar
initscripts-ac574862cc95b534223fd468a0549c04b9459279.tar.gz
initscripts-ac574862cc95b534223fd468a0549c04b9459279.tar.bz2
initscripts-ac574862cc95b534223fd468a0549c04b9459279.tar.xz
initscripts-ac574862cc95b534223fd468a0549c04b9459279.zip
fix some memory handling (#85478, <miked@ed.ac.uk>)
Diffstat (limited to 'src/ipcalc.c')
-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) {