From: Simon Horman Date: Fri, 15 Jul 2011 04:14:07 +0000 (+0900) Subject: [MINOR] Consistently free expr on error in cfg_parse_listen() X-Git-Tag: v1.5-dev8~189 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5e55f5dadcd0d4155541e7e584c5a8c4a14b71c1;p=thirdparty%2Fhaproxy.git [MINOR] Consistently free expr on error in cfg_parse_listen() It seems to me that without this change cfg_parse_listen() may leak memory. --- diff --git a/src/cfgparse.c b/src/cfgparse.c index 145d21f6c0..6e38962d2a 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -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)