mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-25 07:41:36 +02:00
BUG/MINOR: tools: Fix a memory leak on error path in parse_dotted_uints()
When an invalid character is found during parsing in parse_dotted_uints() function, the allocated array of uint must be released. This patch fixes a memory leak on error path during the configuration parsing. This patch should fix the issue #1106. It should be backported as far as 2.0. Note that, for 2.1 and 2.0, the function is in src/standard.c
This commit is contained in:
parent
0aeaa290da
commit
4b524124db
@ -4810,8 +4810,10 @@ int parse_dotted_uints(const char *str, unsigned int **nums, size_t *sz)
|
|||||||
/* Expected characters after having read an uint: '\0' or '.',
|
/* Expected characters after having read an uint: '\0' or '.',
|
||||||
* if '.', must not be terminal.
|
* if '.', must not be terminal.
|
||||||
*/
|
*/
|
||||||
if (*s != '\0'&& (*s++ != '.' || s == end))
|
if (*s != '\0'&& (*s++ != '.' || s == end)) {
|
||||||
|
free(n);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
n = my_realloc2(n, (*sz + 1) * sizeof *n);
|
n = my_realloc2(n, (*sz + 1) * sizeof *n);
|
||||||
if (!n)
|
if (!n)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user