From 1d6095d5ac6482672dbb434b8df7c5de69b9d64e Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 21 Oct 2011 15:13:32 +0200 Subject: add a few missing null pointer checks, and fix check vs dereference order in some cases (patch by Stanislav Fomichev) --- ucimap.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ucimap.c') 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; -- cgit v1.2.1