remove internal usage of redundant uci_ptr.last
[project/uci.git] / libuci.c
index 786d03511b063ac80ec8c887f86e55dfd3d8d819..ae4c96476507c42e55f6817dd67d8a5c15bbcf1a 100644 (file)
--- a/libuci.c
+++ b/libuci.c
@@ -48,11 +48,10 @@ struct uci_context *uci_alloc_context(void)
 {
        struct uci_context *ctx;
 
-       ctx = (struct uci_context *) malloc(sizeof(struct uci_context));
+       ctx = (struct uci_context *) calloc(1, sizeof(struct uci_context));
        if (!ctx)
                return NULL;
 
-       memset(ctx, 0, sizeof(struct uci_context));
        uci_list_init(&ctx->root);
        uci_list_init(&ctx->delta_path);
        uci_list_init(&ctx->backends);