summaryrefslogtreecommitdiffstats
path: root/plugins/check_ping.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_ping.c')
-rw-r--r--plugins/check_ping.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index ab5e0cc3..1d34656c 100644
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
@@ -74,7 +74,8 @@ main (int argc, char **argv)
74 bindtextdomain (PACKAGE, LOCALEDIR); 74 bindtextdomain (PACKAGE, LOCALEDIR);
75 textdomain (PACKAGE); 75 textdomain (PACKAGE);
76 76
77 addresses = malloc ((size_t)max_addr); 77 addresses = malloc (sizeof(char*) * max_addr);
78 addresses[0] = NULL;
78 79
79 if (process_arguments (argc, argv) == ERROR) 80 if (process_arguments (argc, argv) == ERROR)
80 usage (_("Could not parse arguments")); 81 usage (_("Could not parse arguments"));
@@ -228,7 +229,7 @@ process_arguments (int argc, char **argv)
228 n_addresses++; 229 n_addresses++;
229 if (n_addresses > max_addr) { 230 if (n_addresses > max_addr) {
230 max_addr *= 2; 231 max_addr *= 2;
231 addresses = realloc (addresses, (size_t)max_addr); 232 addresses = realloc (addresses, sizeof(char*) * max_addr);
232 if (addresses == NULL) 233 if (addresses == NULL)
233 die (STATE_UNKNOWN, _("Could not realloc() addresses\n")); 234 die (STATE_UNKNOWN, _("Could not realloc() addresses\n"));
234 } 235 }
@@ -272,6 +273,7 @@ process_arguments (int argc, char **argv)
272 return ERROR; 273 return ERROR;
273 } else { 274 } else {
274 addresses[0] = argv[c++]; 275 addresses[0] = argv[c++];
276 n_addresses++;
275 if (c == argc) 277 if (c == argc)
276 return validate_arguments (); 278 return validate_arguments ();
277 } 279 }