From: Andreas Seltenreich Date: Thu, 3 Mar 2016 19:40:37 +0000 (+0100) Subject: BUG/MINOR: standard: Avoid free of non-allocated pointer X-Git-Tag: v1.7-dev2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=93f91c3082b9eb28b3ca60c44f158ca471b6003f;p=thirdparty%2Fhaproxy.git BUG/MINOR: standard: Avoid free of non-allocated pointer The original author forgot to dereference the argument to free in parse_binary. This may result in a crash on reading bad input from the configuration file instead of a proper error message. Found in HAProxy 1.5.14. --- diff --git a/src/standard.c b/src/standard.c index 30883d759f..40727b0dd8 100644 --- a/src/standard.c +++ b/src/standard.c @@ -2052,8 +2052,10 @@ int parse_binary(const char *source, char **binstr, int *binstrlen, char **err) bad_input: memprintf(err, "an hex digit is expected (found '%c')", p[i-1]); - if (alloc) - free(binstr); + if (alloc) { + free(*binstr); + *binstr = NULL; + } return 0; }