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.
(cherry picked from commit 93f91c3082b9eb28b3ca60c44f158ca471b6003f)
(cherry picked from commit facbbde67bf053c57357faf9971bafe7b023ef64)
diff --git a/src/standard.c b/src/standard.c
index 9299882..054a5b6 100644
--- a/src/standard.c
+++ b/src/standard.c
@@ -1704,8 +1704,10 @@
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;
}