summaryrefslogtreecommitdiff
path: root/libc/misc/regex
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2006-01-11 20:16:43 +0000
committerPeter S. Mazinger <ps.m@gmx.net>2006-01-11 20:16:43 +0000
commit4af711dfe8caf18756c2cb28f72b102c5eba3930 (patch)
treec67f283325f777d88299d50779a6760aae240ce4 /libc/misc/regex
parent9bdb97c69e9b565f09e2a135561fedf45a70ee5d (diff)
Apply patch used in sed for malloc(0)
Diffstat (limited to 'libc/misc/regex')
-rw-r--r--libc/misc/regex/regex_internal.c5
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;
}