]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: regex: modify regex_comp() to atomically allocate/free the my_regex struct
authorDragan Dosen <ddosen@haproxy.com>
Tue, 30 Apr 2019 13:54:36 +0000 (15:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 7 May 2019 04:58:15 +0000 (06:58 +0200)
commit2674303912347b9533bbc6e5a042bff815bbc2e7
tree8d70cc60639ba5b285780861fc956ebf50ceaaab
parent4d7894870a79431a1707792098af9b4767a20700
MEDIUM: regex: modify regex_comp() to atomically allocate/free the my_regex struct

Now we atomically allocate the my_regex struct within function
regex_comp() and compile the regex or free both in case of failure. The
pointer to the allocated my_regex struct is returned directly. The
my_regex* argument to regex_comp() is removed.

Function regex_free() was modified so that it systematically frees the
my_regex entry. The function does nothing when called with a NULL as
argument (like free()). It will avoid existing risk of not properly
freeing the initialized area.

Other structures are also updated in order to be compatible (the ones
related to Lua and action rules).
14 files changed:
include/common/regex.h
include/types/action.h
include/types/hlua.h
src/cfgparse-listen.c
src/checks.c
src/haproxy.c
src/hlua.c
src/hlua_fcn.c
src/http_rules.c
src/pattern.c
src/proto_http.c
src/proto_htx.c
src/regex.c
src/sample.c