X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Ftcpconns.c;h=5d4bb6966f98b024e57ffc7fd0956082777212ab;hb=354f9991530248e45207d236eb74c1cc3d5238ef;hp=8f40be6f786b13d901c4ee5847580c0a01db270e;hpb=8eb05d21637cd1eb3b6c4c4d3ed519cc2fd3ebf6;p=collectd.git diff --git a/src/tcpconns.c b/src/tcpconns.c index 8f40be6f..6bc33842 100644 --- a/src/tcpconns.c +++ b/src/tcpconns.c @@ -283,7 +283,7 @@ static uint32_t count_total[TCP_STATE_MAX + 1]; static uint32_t sequence_number = 0; #endif -enum +static enum { SRC_DUNNO, SRC_NETLINK, @@ -385,10 +385,9 @@ static port_entry_t *conn_get_port_entry (uint16_t port, int create) if ((ret == NULL) && (create != 0)) { - ret = (port_entry_t *) malloc (sizeof (port_entry_t)); + ret = calloc (1, sizeof (*ret)); if (ret == NULL) return (NULL); - memset (ret, '\0', sizeof (port_entry_t)); ret->port = port; ret->next = port_list_head; @@ -832,7 +831,7 @@ static int conn_read (void) return (-1); } - buffer = (char *) malloc (buffer_len); + buffer = malloc (buffer_len); if (buffer == NULL) { ERROR ("tcpconns plugin: malloc failed.");