check result of memory allocations (patch by Stanislav Fomichev)
[project/uci.git] / ucimap.c
index 16ce56a..6a5c117 100644 (file)
--- a/ucimap.c
+++ b/ucimap.c
@@ -275,6 +275,8 @@ ucimap_resize_list(struct ucimap_section_data *sd, struct ucimap_list **list, in
 
        if (!*list) {
                new = calloc(1, size);
+               if (!new)
+                       return -ENOMEM;
 
                ucimap_add_alloc(sd, new);
                goto set;