mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-19 10:14:41 +00:00
MINOR: log: add free_logformat_node() helper function
Function may be used to free a single logformat node.
This commit is contained in:
parent
62121d5b90
commit
1c2e16ba8a
@ -66,6 +66,7 @@ void deinit_log_buffers(void);
|
||||
|
||||
/* Deinitialize log buffers used for syslog messages */
|
||||
void free_logformat_list(struct list *fmt);
|
||||
void free_logformat_node(struct logformat_node *node);
|
||||
|
||||
/* build a log line for the session and an optional stream */
|
||||
int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t maxsize, struct list *list_format);
|
||||
|
18
src/log.c
18
src/log.c
@ -2660,6 +2660,19 @@ void deinit_log_forward()
|
||||
}
|
||||
}
|
||||
|
||||
/* Releases memory for a single log-format node */
|
||||
void free_logformat_node(struct logformat_node *node)
|
||||
{
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
release_sample_expr(node->expr);
|
||||
node->expr = NULL;
|
||||
ha_free(&node->name);
|
||||
ha_free(&node->arg);
|
||||
ha_free(&node);
|
||||
}
|
||||
|
||||
/* Releases memory allocated for a log-format string */
|
||||
void free_logformat_list(struct list *fmt)
|
||||
{
|
||||
@ -2670,10 +2683,7 @@ void free_logformat_list(struct list *fmt)
|
||||
|
||||
list_for_each_entry_safe(lf, lfb, fmt, list) {
|
||||
LIST_DELETE(&lf->list);
|
||||
release_sample_expr(lf->expr);
|
||||
free(lf->name);
|
||||
free(lf->arg);
|
||||
free(lf);
|
||||
free_logformat_node(lf);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user