summaryrefslogtreecommitdiff
path: root/ucimap.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-10-21 15:13:32 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-10-21 15:17:06 +0200
commit1d6095d5ac6482672dbb434b8df7c5de69b9d64e (patch)
tree917e444e61e7a252ba18a5dea3b1d4d76ac2e103 /ucimap.c
parentef95525edc1ade7e729187b011de889b8f5f57c6 (diff)
downloaduci-1d6095d5ac6482672dbb434b8df7c5de69b9d64e.tar.gz
add a few missing null pointer checks, and fix check vs dereference order in some cases (patch by Stanislav Fomichev)
Diffstat (limited to 'ucimap.c')
-rw-r--r--ucimap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ucimap.c b/ucimap.c
index 6a5c117..0bc31c5 100644
--- a/ucimap.c
+++ b/ucimap.c
@@ -295,6 +295,9 @@ realloc:
offset = (items - (*list)->size) * sizeof(union ucimap_data);
a->ptr = realloc(a->ptr, size);
+ if (!a->ptr)
+ return -ENOMEM;
+
if (offset)
memset((char *) a->ptr + offset, 0, size - offset);
new = a->ptr;