summaryrefslogtreecommitdiffstats
path: root/web/attachments/75985-nagios_check_ping.patch
blob: 6fd59cfd036ceb23963da5977726394de7db781e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Index: check_ping.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ping.c,v
retrieving revision 1.25
diff -u -r1.25 check_ping.c
--- check_ping.c	12 Sep 2003 11:38:32 -0000	1.25
+++ check_ping.c	7 Feb 2004 01:42:33 -0000
@@ -74,7 +74,8 @@
 	bindtextdomain (PACKAGE, LOCALEDIR);
 	textdomain (PACKAGE);
 
-	addresses = malloc ((size_t)max_addr);
+	addresses = malloc (sizeof(char*) * max_addr);
+	addresses[0] = NULL;
 
 	if (process_arguments (argc, argv) == ERROR)
 		usage (_("Could not parse arguments"));
@@ -228,7 +229,7 @@
 				n_addresses++;
 				if (n_addresses > max_addr) {
 					max_addr *= 2;
-					addresses = realloc (addresses, (size_t)max_addr);
+					addresses = realloc (addresses, sizeof(char*) * max_addr);
 					if (addresses == NULL)
 						die (STATE_UNKNOWN, _("Could not realloc() addresses\n"));
 				}
@@ -272,6 +273,7 @@
 			return ERROR;
 		} else {
 			addresses[0] = argv[c++];
+			n_addresses++;
 			if (c == argc)
 				return validate_arguments ();
 		}