mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 00:27:08 +02:00
MINOR: fix a few memory usage errors
These are either use after free errors or small leaks where memory is not free'd after some error state is detected.
This commit is contained in:
parent
e21f84903e
commit
07fcaaa4cd
@ -134,6 +134,7 @@ int userlist_postinit()
|
|||||||
if (!ag) {
|
if (!ag) {
|
||||||
Alert("userlist '%s': no such group '%s' specified in user '%s'\n",
|
Alert("userlist '%s': no such group '%s' specified in user '%s'\n",
|
||||||
curuserlist->name, group, curuser->user);
|
curuserlist->name, group, curuser->user);
|
||||||
|
free(groups);
|
||||||
return ERR_ALERT | ERR_FATAL;
|
return ERR_ALERT | ERR_FATAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,6 +143,7 @@ int userlist_postinit()
|
|||||||
if (!grl) {
|
if (!grl) {
|
||||||
Alert("userlist '%s': no more memory when trying to allocate the user groups.\n",
|
Alert("userlist '%s': no more memory when trying to allocate the user groups.\n",
|
||||||
curuserlist->name);
|
curuserlist->name);
|
||||||
|
free(groups);
|
||||||
return ERR_ALERT | ERR_FATAL;
|
return ERR_ALERT | ERR_FATAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1578,8 +1578,6 @@ static int create_cond_regex_rule(const char *file, int line,
|
|||||||
if (dir == SMP_OPT_DIR_REQ && warnif_misplaced_reqxxx(px, file, line, cmd))
|
if (dir == SMP_OPT_DIR_REQ && warnif_misplaced_reqxxx(px, file, line, cmd))
|
||||||
err_code |= ERR_WARN;
|
err_code |= ERR_WARN;
|
||||||
|
|
||||||
free(errmsg);
|
|
||||||
return err_code;
|
|
||||||
err:
|
err:
|
||||||
free(errmsg);
|
free(errmsg);
|
||||||
free(preg);
|
free(preg);
|
||||||
|
@ -1610,6 +1610,8 @@ int main(int argc, char **argv)
|
|||||||
exit(0); /* parent must leave */
|
exit(0); /* parent must leave */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(children);
|
||||||
|
children = NULL;
|
||||||
/* if we're NOT in QUIET mode, we should now close the 3 first FDs to ensure
|
/* if we're NOT in QUIET mode, we should now close the 3 first FDs to ensure
|
||||||
* that we can detach from the TTY. We MUST NOT do it in other cases since
|
* that we can detach from the TTY. We MUST NOT do it in other cases since
|
||||||
* it would have already be done, and 0-2 would have been affected to listening
|
* it would have already be done, and 0-2 would have been affected to listening
|
||||||
|
@ -1076,8 +1076,8 @@ int pat_idx_list_reg(struct pattern_expr *expr, struct pattern *pat, char **err)
|
|||||||
|
|
||||||
/* compile regex */
|
/* compile regex */
|
||||||
if (!regex_comp(pat->ptr.str, patl->pat.ptr.reg, !(expr->mflags & PAT_MF_IGNORE_CASE), 0, err)) {
|
if (!regex_comp(pat->ptr.str, patl->pat.ptr.reg, !(expr->mflags & PAT_MF_IGNORE_CASE), 0, err)) {
|
||||||
free(patl);
|
|
||||||
free(patl->pat.ptr.reg);
|
free(patl->pat.ptr.reg);
|
||||||
|
free(patl);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1458,14 +1458,14 @@ int pat_ref_delete(struct pat_ref *ref, const char *key)
|
|||||||
/* delete pattern from reference */
|
/* delete pattern from reference */
|
||||||
list_for_each_entry_safe(elt, safe, &ref->head, list) {
|
list_for_each_entry_safe(elt, safe, &ref->head, list) {
|
||||||
if (strcmp(key, elt->pattern) == 0) {
|
if (strcmp(key, elt->pattern) == 0) {
|
||||||
|
list_for_each_entry(expr, &ref->pat, list)
|
||||||
|
pattern_delete(expr, elt);
|
||||||
|
|
||||||
LIST_DEL(&elt->list);
|
LIST_DEL(&elt->list);
|
||||||
free(elt->sample);
|
free(elt->sample);
|
||||||
free(elt->pattern);
|
free(elt->pattern);
|
||||||
free(elt);
|
free(elt);
|
||||||
|
|
||||||
list_for_each_entry(expr, &ref->pat, list)
|
|
||||||
pattern_delete(expr, elt);
|
|
||||||
|
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user