use calloc instead of malloc+memset
[project/firewall3.git] / main.c
diff --git a/main.c b/main.c
index 17d71d1..455c049 100644 (file)
--- a/main.c
+++ b/main.c
@@ -45,12 +45,10 @@ build_state(bool runtime)
        struct uci_package *p = NULL;
        FILE *sf;
 
-       state = malloc(sizeof(*state));
-
+       state = calloc(1, sizeof(*state));
        if (!state)
                error("Out of memory");
 
-       memset(state, 0, sizeof(*state));
        state->uci = uci_alloc_context();
 
        if (!state->uci)