diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2020-10-04 17:14:50 +0200 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2020-10-06 08:35:21 +0200 |
commit | 3fbd6c923434db61267e1331319b5b125e7838d8 (patch) | |
tree | dd58c8a70e5a4c4f9d9a768ca926aa6b01e39c77 | |
parent | eae126f66663e5c73e5d290b8e3134449489340f (diff) | |
download | uci-3fbd6c923434db61267e1331319b5b125e7838d8.tar.gz |
ucimap: Check return of malloc()
Check the return value of malloc() before accessing it.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r-- | ucimap.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -893,14 +893,16 @@ ucimap_parse(struct uci_map *map, struct uci_package *pkg) if (sm->alloc) { sd = sm->alloc(map, sm, s); + if (!sd) + continue; memset(sd, 0, sizeof(struct ucimap_section_data)); } else { sd = malloc(sm->alloc_len); + if (!sd) + continue; memset(sd, 0, sm->alloc_len); sd = ucimap_ptr_section(sm, sd); } - if (!sd) - continue; ucimap_parse_section(map, sm, sd, s); } |