aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/netcalc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/netcalc.c b/src/netcalc.c
index 6cb389f..8c3ae45 100644
--- a/src/netcalc.c
+++ b/src/netcalc.c
@@ -382,6 +382,7 @@ int netcalc_ip_parse( netcalc * cnf, netcalc_ip ** ipp, const char * ipstr )
382 if ((endptr[0] != '\0') || (&ptr[1] == endptr)) 382 if ((endptr[0] != '\0') || (&ptr[1] == endptr))
383 { 383 {
384 fprintf(stderr, "%s: invalid CIDR\n", PROGRAM_NAME); 384 fprintf(stderr, "%s: invalid CIDR\n", PROGRAM_NAME);
385 netcalc_ip_free(ip);
385 free(str); 386 free(str);
386 return(1); 387 return(1);
387 }; 388 };
@@ -394,6 +395,7 @@ int netcalc_ip_parse( netcalc * cnf, netcalc_ip ** ipp, const char * ipstr )
394 if ((cidr < -1) || (cidr > 32)) 395 if ((cidr < -1) || (cidr > 32))
395 { 396 {
396 fprintf(stderr, "%s: invalid CIDR\n", PROGRAM_NAME); 397 fprintf(stderr, "%s: invalid CIDR\n", PROGRAM_NAME);
398 netcalc_ip_free(ip);
397 free(str); 399 free(str);
398 return(1); 400 return(1);
399 }; 401 };
@@ -414,6 +416,7 @@ int netcalc_ip_parse( netcalc * cnf, netcalc_ip ** ipp, const char * ipstr )
414 if ((cidr < -1) || (cidr > 128)) 416 if ((cidr < -1) || (cidr > 128))
415 { 417 {
416 fprintf(stderr, "%s: invalid CIDR\n", PROGRAM_NAME); 418 fprintf(stderr, "%s: invalid CIDR\n", PROGRAM_NAME);
419 netcalc_ip_free(ip);
417 free(str); 420 free(str);
418 return(1); 421 return(1);
419 }; 422 };
@@ -1073,6 +1076,7 @@ int main(int argc, char * argv[])
1073 }; 1076 };
1074 }; 1077 };
1075 1078
1079 // sets defaults and adjusts cidr
1076 if (cnf->family == NETCALC_INET) 1080 if (cnf->family == NETCALC_INET)
1077 { 1081 {
1078 cnf->cidr_limit = ((cnf->cidr_limit == -1) ? 32 : cnf->cidr_limit) + 128 - 32; 1082 cnf->cidr_limit = ((cnf->cidr_limit == -1) ? 32 : cnf->cidr_limit) + 128 - 32;