From 4af711dfe8caf18756c2cb28f72b102c5eba3930 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 11 Jan 2006 20:16:43 +0000 Subject: Apply patch used in sed for malloc(0) --- libc/misc/regex/regex_internal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libc/misc/regex') diff --git a/libc/misc/regex/regex_internal.c b/libc/misc/regex/regex_internal.c index c1ee85040..6299f547e 100644 --- a/libc/misc/regex/regex_internal.c +++ b/libc/misc/regex/regex_internal.c @@ -882,8 +882,9 @@ re_node_set_alloc (re_node_set *set, int size) { set->alloc = size; set->nelem = 0; - set->elems = re_malloc (int, size); - if (BE (set->elems == NULL, 0)) + set->elems = re_malloc (int, size); /* can be NULL if size == 0 + (see re_node_set_init_empty(set)) */ + if (BE (set->elems == NULL && size != 0, 0)) return REG_ESPACE; return REG_NOERROR; } -- cgit v1.2.3