X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=ucimap-example.c;h=18c3c1f05397bcb5137530226f817fbe373e1af9;hp=e04c66ddcc6b647ffc704d3e47590634854424f0;hb=ec8cbbbe0f20e67cbd3bd471b9ac55ceacaef7b8;hpb=97e71a1c1b0a9d50f2dc334e72c89153f8b87d45 diff --git a/ucimap-example.c b/ucimap-example.c index e04c66d..18c3c1f 100644 --- a/ucimap-example.c +++ b/ucimap-example.c @@ -132,6 +132,8 @@ static struct ucimap_section_data * network_allocate(struct uci_map *map, struct uci_sectionmap *sm, struct uci_section *s) { struct uci_network *p = malloc(sizeof(struct uci_network)); + if (!p) + return NULL; memset(p, 0, sizeof(struct uci_network)); return &p->map; } @@ -244,6 +246,8 @@ int main(int argc, char **argv) INIT_LIST_HEAD(&ifs); ctx = uci_alloc_context(); + if (!ctx) + return -1; ucimap_init(&network_map); if ((argc >= 2) && !strcmp(argv[1], "-s")) {