Closed
Description
In apache2/msc_pcre.c line 68-74, we will get regex->pe from pcre_study() if we compile with --enable-pcre-study.
#ifdef WITH_PCRE_STUDY
#ifdef WITH_PCRE_JIT
pe = pcre_study(regex->re, PCRE_STUDY_JIT_COMPILE, &errptr);
#else
pe = pcre_study(regex->re, 0, &errptr);
#endif
#endif
However we will use pcre_free() or free() to free it in msc_pcre_cleanup(), the right choice here is pcre_free_study().
if (regex->pe != NULL) {
if defined(VERSION_NGINX)
pcre_free(regex->pe);
else
free(regex->pe);
endif
regex->pe = NULL;
}
This will lead to memory leak, the memory that leaked was allocated use SLJIT_MALLOC in pcre_study().
This can be a big problem if we use Apache graceful restart.