Don't allocate a zero byte segment.

PR:		bin/11900
MFC after:	2 weeks
This commit is contained in:
Mike Heffner 2001-11-08 16:47:05 +00:00
parent 6183dc49fb
commit 0ea56610b4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=86193

View File

@ -138,7 +138,10 @@ compile()
*compile_stream(&prog) = NULL;
fixuplabel(prog, NULL);
uselabel();
if ((appends = malloc(sizeof(struct s_appends) * appendnum)) == NULL)
if (appendnum == 0)
appends = NULL;
else if ((appends = malloc(sizeof(struct s_appends) * appendnum)) ==
NULL)
err(1, "malloc");
if ((match = malloc((maxnsub + 1) * sizeof(regmatch_t))) == NULL)
err(1, "malloc");