From: Andreas Seltenreich Date: Thu, 3 Mar 2016 19:20:23 +0000 (+0100) Subject: BUG/MINOR: pattern: Avoid memory leak on out-of-memory condition X-Git-Tag: v1.7-dev2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e6e22e8e909dc10be3ebeb4d18179dd8970d119e;p=thirdparty%2Fhaproxy.git BUG/MINOR: pattern: Avoid memory leak on out-of-memory condition pattern_new_expr() failed to free the allocated list element when an out-of-memory error occurs during initialization of the element. As this only happens when loading the configuration file or evaluating commands via the CLI, it is unlikely for this leak to be relevant unless the user makes automated, heavy use of the CLI. Found in HAProxy 1.5.14. --- diff --git a/src/pattern.c b/src/pattern.c index 9d07b89c5a..60fe462a10 100644 --- a/src/pattern.c +++ b/src/pattern.c @@ -2063,6 +2063,7 @@ struct pattern_expr *pattern_new_expr(struct pattern_head *head, struct pat_ref /* Get a lot of memory for the expr struct. */ expr = malloc(sizeof(*expr)); if (!expr) { + free(list); memprintf(err, "out of memory"); return NULL; }