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.
This commit is contained in:
Andreas Seltenreich 2016-03-03 20:40:37 +01:00 committed by Willy Tarreau
parent 776e518caf
commit 93f91c3082

View File

@ -2052,8 +2052,10 @@ int parse_binary(const char *source, char **binstr, int *binstrlen, char **err)
bad_input: bad_input:
memprintf(err, "an hex digit is expected (found '%c')", p[i-1]); memprintf(err, "an hex digit is expected (found '%c')", p[i-1]);
if (alloc) if (alloc) {
free(binstr); free(*binstr);
*binstr = NULL;
}
return 0; return 0;
} }