Le 18/05/2014 00:34, Cyril Bonté a écrit :
One thing is that I don't understand the initial patch provided by
Dirkjan :
http://haproxy.1wt.eu/git?p=haproxy.git;a=commitdiff;h=07fcaaa4cd89002cb100644197752ea050f54bee;hp=e21f84903ef334c02f2783b20a128f381263e676#patch2
Why would we want to free the preg memory when no error occurs ?
I'm really not sure this fix is valid.
Well, now I'm sure it wasn't and I also could reproduce segfaults.
We should revert part of the last commit : the preg allocation is
cleanly deallocated in the deinit() function, when it is needed.
Btw, with that last commit, whatever happens, we enter the "err" section
of the function, which is kind of a non sense when the function succeeds ;-)
Thomas, can you try with this one :
diff --git a/src/cfgparse.c b/src/cfgparse.c
index eb7ec20..8a309f0 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -1578,9 +1578,14 @@ static int create_cond_regex_rule(const char
*file, int line,
if (dir == SMP_OPT_DIR_REQ && warnif_misplaced_reqxxx(px, file, line,
cmd))
err_code |= ERR_WARN;
+ free(errmsg);
+ return err_code;
err:
free(errmsg);
- free(preg);
+ if (preg) {
+ regfree(preg);
+ free(preg);
+ }
return err_code;
}
--
Cyril Bonté