Skip to content

Commit 64b883b

Browse files
author
Marc Stern
authored
Merge pull request #2946 from marcstern/v2/mst/issue610
Fix for #610
2 parents ac04a44 + ba227fa commit 64b883b

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

apache2/msc_pcre.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ static apr_status_t msc_pcre_cleanup(msc_regex_t *regex) {
3131
}
3232
#else
3333
if (regex->pe != NULL) {
34-
#if defined(VERSION_NGINX)
3534
pcre_free(regex->pe);
36-
#else
37-
free(regex->pe);
38-
#endif
3935
regex->pe = NULL;
4036
}
4137
if (regex->re != NULL) {
@@ -152,19 +148,15 @@ void *msc_pregcomp_ex(apr_pool_t *pool, const char *pattern, int options,
152148

153149
#ifdef WITH_PCRE_STUDY
154150
#ifdef WITH_PCRE_JIT
155-
pe = pcre_study(regex->re, PCRE_STUDY_JIT_COMPILE, &errptr);
151+
pe = pcre_study(regex->re, PCRE_STUDY_EXTRA_NEEDED|PCRE_STUDY_JIT_COMPILE, &errptr);
156152
#else
157-
pe = pcre_study(regex->re, 0, &errptr);
153+
pe = pcre_study(regex->re, PCRE_STUDY_EXTRA_NEEDED, &errptr);
158154
#endif
159155
#endif
160156

161157
/* Setup the pcre_extra record if pcre_study did not already do it */
162158
if (pe == NULL) {
163-
#if defined(VERSION_NGINX)
164-
pe = pcre_malloc(sizeof(pcre_extra));
165-
#else
166-
pe = malloc(sizeof(pcre_extra));
167-
#endif
159+
pe = (pcre_extra*)pcre_malloc(sizeof(pcre_extra));
168160
if (pe == NULL) {
169161
return NULL;
170162
}

0 commit comments

Comments
 (0)