]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: patterns: fix double free caused by loading strings from files
authorWilly Tarreau <w@1wt.eu>
Mon, 16 Dec 2013 09:40:28 +0000 (10:40 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 16 Dec 2013 09:40:28 +0000 (10:40 +0100)
A null pointer assignment was missing after a free in commit 7148ce6 (MEDIUM:
pattern: Extract the index process from the pat_parse_*() functions), causing
a double free after loading a file of string patterns.

This bug was introduced in 1.5-dev20, no backport is needed.

Thanks to Sander Klein for reporting this bug and providing the config
needed to trigger it.

src/pattern.c

index ce60f7639dd3275721ca6ed026dd4ab102c082ac..8380c636fef30393dea6695d3519c5d71e55abae 100644 (file)
@@ -882,6 +882,7 @@ int pattern_register(struct pattern_expr *expr, const char **args,
 
                        /* the "map_parser_str()" function always duplicate string information */
                        free((*pattern)->ptr.str);
+                       (*pattern)->ptr.str = NULL;
 
                        /* we pre-set the data pointer to the tree's head so that functions
                         * which are able to insert in a tree know where to do that.