]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Allocate client_sock using calloc instead of malloc
authorClar Fon <them@lightdark.xyz>
Thu, 22 Aug 2019 21:48:42 +0000 (17:48 -0400)
committerTobias Oetiker <tobi@oetiker.ch>
Mon, 26 Aug 2019 06:05:52 +0000 (08:05 +0200)
This ensures that wbuf_data, wbuf_size, and wbuf_capacity are all initialised to zero

src/rrd_daemon.c

index 521aedaaf0d0288302e2b498b31d24ccf8672e70..5a7ed28140c117ff749e4bc37869635c86908039 100644 (file)
@@ -4125,7 +4125,7 @@ static void *listen_thread_main(
                 continue;
             }
 
-            client_sock = (listen_socket_t *) malloc(sizeof(listen_socket_t));
+            client_sock = (listen_socket_t *) calloc(1, sizeof(listen_socket_t));
             if (client_sock == NULL) {
                 RRDD_LOG(LOG_ERR, "listen_thread_main: malloc failed.");
                 continue;