Commit fde3c9b5 authored by Geoff Simmons's avatar Geoff Simmons

varnishevent: cleanup in format.c

parent 05b93afe
......@@ -41,10 +41,6 @@
#include "miniobj.h"
#include "base64.h"
#define C(spec) ((spec) & VSL_S_CLIENT)
#define B(spec) ((spec) & VSL_S_BACKEND)
#define Z(spec) ((spec) == 0)
#define TAG(ll,t) ((ll)->tag[tag2idx[(t)]])
typedef void formatter_f(logline_t *ll, char *name, enum VSL_tag_e tag,
......@@ -910,9 +906,28 @@ FMT_Format(logline_t *ll, struct vsb *os)
}
}
static void
free_format(compiled_fmt_t *fmt)
{
for (int i; i < fmt->n; i++) {
free(fmt->str[i]);
if (fmt->args[i].name != NULL)
free(fmt->args[i].name);
}
free(fmt->str);
free(fmt->formatter);
free(fmt->args);
}
void
FMT_Shutdown(void)
{
/* XXX: remaining cleanup */
free(scratch);
if (!EMPTY(config.cformat))
free_format(&cformat);
if (!EMPTY(config.bformat))
free_format(&bformat);
if (!EMPTY(config.zformat))
free_format(&zformat);
}
......@@ -42,6 +42,7 @@
#define C(spec) ((spec) & VSL_S_CLIENT)
#define B(spec) ((spec) & VSL_S_BACKEND)
#define Z(spec) ((spec) == 0)
/* Defaults from Varnish 3.0.3 */
#define DEFAULT_MAX_RECLEN 255 /* shm_reclen */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment