properly initialize the just allocated global structures
Costa Tsaousis (ktsaou) committed
Mar 17, 2017 at 00:57 UTC
577a1f4a41082cc121ee9007e99eabe41550b24d
1 file changed
+1
-4
src/plugin_nfacct.c
+1
-4
@@ -32,10 +32,7 @@ static inline void nfacct_list_grow() {
32
info("nfacct.plugin: increasing nfacct_list to size %d", size);
33
34
nfacct_list = reallocz(nfacct_list, sizeof(struct nfacct_list) + (sizeof(struct mynfacct) * size));
35
-
36
- nfacct_list->data[len].rd_bytes = NULL;
37
- nfacct_list->data[len].rd_packets = NULL;
38
- nfacct_list->data[len].updated = 0;
35
+ memset(&nfacct_list->data[len], 0, sizeof(struct mynfacct));
36
37
nfacct_list->size = size;
38
nfacct_list->len = len;