From 93f91c3082b9eb28b3ca60c44f158ca471b6003f Mon Sep 17 00:00:00 2001 From: Andreas Seltenreich Date: Thu, 3 Mar 2016 20:40:37 +0100 Subject: [PATCH] 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. --- src/standard.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; } -- 2.47.3