diff options
Diffstat (limited to 'libc/misc/regex')
-rw-r--r-- | libc/misc/regex/regex_internal.c | 5 |
1 files changed, 3 insertions, 2 deletions
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; } |