mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 13:51:26 +02:00
BUG/MINOR: cfgparse: couple of small memory leaks.
During the config parse in some code paths, there is some forgotten pointers freeing, and as often, during errors handlings.
This commit is contained in:
parent
d10025c671
commit
97880bb46d
@ -1611,8 +1611,10 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
|||||||
arg += 2;
|
arg += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alertif_too_many_args_idx(3, arg + 1, file, linenum, args, &err_code))
|
if (alertif_too_many_args_idx(3, arg + 1, file, linenum, args, &err_code)) {
|
||||||
|
free(logsrv);
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
logsrv->facility = get_log_facility(args[arg+2]);
|
logsrv->facility = get_log_facility(args[arg+2]);
|
||||||
if (logsrv->facility < 0) {
|
if (logsrv->facility < 0) {
|
||||||
@ -6793,6 +6795,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
|
|||||||
if (!newul->name) {
|
if (!newul->name) {
|
||||||
Alert("parsing [%s:%d]: out of memory.\n", file, linenum);
|
Alert("parsing [%s:%d]: out of memory.\n", file, linenum);
|
||||||
err_code |= ERR_ALERT | ERR_ABORT;
|
err_code |= ERR_ALERT | ERR_ABORT;
|
||||||
|
free(newul);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6978,8 +6981,10 @@ int readcfgfile(const char *file)
|
|||||||
!cfg_register_section("resolvers", cfg_parse_resolvers))
|
!cfg_register_section("resolvers", cfg_parse_resolvers))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ((f=fopen(file,"r")) == NULL)
|
if ((f=fopen(file,"r")) == NULL) {
|
||||||
|
free(thisline);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
next_line:
|
next_line:
|
||||||
while (fgets(thisline + readbytes, linesize - readbytes, f) != NULL) {
|
while (fgets(thisline + readbytes, linesize - readbytes, f) != NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user