projects
/
project
/
uci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
eae126f
)
ucimap: Check return of malloc()
author
Hauke Mehrtens
<
[email protected]
>
Sun, 4 Oct 2020 15:14:50 +0000
(17:14 +0200)
committer
Petr Štetiar
<
[email protected]
>
Tue, 6 Oct 2020 06:35:21 +0000
(08:35 +0200)
Check the return value of malloc() before accessing it.
Signed-off-by: Hauke Mehrtens <
[email protected]
>
ucimap.c
patch
|
blob
|
history
diff --git
a/ucimap.c
b/ucimap.c
index 7c2b0435d308358c83cfa89d7f14133ad4dca008..c46cf45a40d7a4f222d8353d42f6e45c706f7bc7 100644
(file)
--- a/
ucimap.c
+++ b/
ucimap.c
@@
-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);
}