]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
reset pcre_malloc only once
authorAlan T. DeKok <aland@freeradius.org>
Fri, 12 Feb 2021 12:46:48 +0000 (07:46 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 12 Feb 2021 12:46:48 +0000 (07:46 -0500)
src/lib/regex.c

index 173bda9e28f1662e06bb569d45250387fa5b81f0..64a6dbe31ec5edf809d74b34ac50656b75f3c6d9 100644 (file)
@@ -96,7 +96,7 @@ ssize_t regex_compile(TALLOC_CTX *ctx, regex_t **out, char const *pattern, size_
        int cflags = 0;
        regex_t *preg;
 
-       static bool setup;
+       static bool setup = false;
 
        /*
         *      Lets us use subcapture copy
@@ -104,6 +104,7 @@ ssize_t regex_compile(TALLOC_CTX *ctx, regex_t **out, char const *pattern, size_
        if (!setup) {
                pcre_malloc = _pcre_malloc;
                pcre_free = _pcre_free;
+               setup = true;
        }
 
        *out = NULL;