diff --git a/lib/libcompat/4.3/regex.c b/lib/libcompat/4.3/regex.c index 89d6400b8d7d..9b9697885e42 100644 --- a/lib/libcompat/4.3/regex.c +++ b/lib/libcompat/4.3/regex.c @@ -59,8 +59,11 @@ char * re_comp(s) char *s; { - if (s == NULL || *s == '\0') + if (s == NULL || *s == '\0') { + if (re_regexp == NULL) + return "no previous regular expression"; return (NULL); + } if (re_regexp) free(re_regexp); if (re_errstr)