Commit 279acdb3 authored by Geoff Simmons's avatar Geoff Simmons

varnishevent: data.c cleanup

parent 8a1ca837
......@@ -45,15 +45,29 @@ static pthread_mutex_t freelist_lock;
static char *bufptr;
static int ntags;
#if 0
static void
free_hdrs(hdr_t *hdrs)
{
if (hdrs != NULL) {
free(hdrs->record);
free(hdrs);
}
}
static void
data_Cleanup(void)
{
free(dtbl.entry);
free(dtbl.buf);
for (int i = 0; i < config.max_data; i++) {
free(logline[i].tag);
free_hdrs(logline[i].rx_headers);
free_hdrs(logline[i].tx_headers);
free_hdrs(logline[i].vcl_log);
free_hdrs(logline[i].vcl_call);
}
free(logline);
free(bufptr);
AZ(pthread_mutex_destroy(&freelist_lock));
}
#endif
void
DATA_Clear_Logline(logline_t *ll)
......@@ -153,6 +167,8 @@ DATA_Init(void)
AZ(pthread_mutex_init(&freelist_lock, &attr_lock));
data_open = data_done = data_occ_hi = 0;
global_nfree = config.max_data;
atexit(data_Cleanup);
return(0);
}
......
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