]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] Consistently free expr on error in cfg_parse_listen()
authorSimon Horman <horms@verge.net.au>
Fri, 15 Jul 2011 04:14:07 +0000 (13:14 +0900)
committerWilly Tarreau <w@1wt.eu>
Mon, 18 Jul 2011 08:21:23 +0000 (10:21 +0200)
It seems to me that without this change cfg_parse_listen()
may leak memory.

src/cfgparse.c

index 145d21f6c0a98b6911b10eb23766adadd0dee67d..6e38962d2a5d91a63cab4f700c09bb13c80a9eb5 100644 (file)
@@ -2918,6 +2918,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                                Alert("parsing [%s:%d] : '%s': fetch method '%s' can not be used on response.\n",
                                      file, linenum, args[0], expr->fetch->kw);
                                err_code |= ERR_ALERT | ERR_FATAL;
+                               free(expr);
                                goto out;
                        }
                } else {
@@ -2925,6 +2926,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                                Alert("parsing [%s:%d] : '%s': fetch method '%s' can not be used on request.\n",
                                      file, linenum, args[0], expr->fetch->kw);
                                err_code |= ERR_ALERT | ERR_FATAL;
+                               free(expr);
                                goto out;
                        }
                }
@@ -2939,6 +2941,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                                Alert("parsing [%s:%d] : '%s': error detected while parsing sticking condition.\n",
                                      file, linenum, args[0]);
                                err_code |= ERR_ALERT | ERR_FATAL;
+                               free(expr);
                                goto out;
                        }
                }
@@ -2946,6 +2949,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                        Alert("parsing [%s:%d] : '%s': unknown keyword '%s'.\n",
                              file, linenum, args[0], args[myidx]);
                        err_code |= ERR_ALERT | ERR_FATAL;
+                       free(expr);
                        goto out;
                }
                if (flags & STK_ON_RSP)