]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: config: fix improper check for failed memory alloc in ACL parser
authorWilly Tarreau <w@1wt.eu>
Wed, 23 Jan 2013 23:25:39 +0000 (00:25 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Jan 2013 15:19:18 +0000 (16:19 +0100)
The wrong variable is checked after a calloc() so a memory shortage would
result in a segfault while loading the config instead of a clean error.

This fix may be backported to 1.4 and 1.3 which are both affected.

Reported-by: Dinko Korunic <dkorunic@reflected.net>
src/acl.c

index cba89ab0ef9e698999414c52df1c8fa1f354214c..753f109c9822f2699a29c1ce904b08949aba16ee 100644 (file)
--- a/src/acl.c
+++ b/src/acl.c
@@ -1840,7 +1840,7 @@ struct acl_cond *parse_acl_cond(const char **args, struct list *known_acl, int p
 
                if (!cur_suite) {
                        cur_suite = (struct acl_term_suite *)calloc(1, sizeof(*cur_suite));
-                       if (cur_term == NULL) {
+                       if (cur_suite == NULL) {
                                memprintf(err, "out of memory when parsing condition");
                                goto out_free_term;
                        }