Memory leak fixes

This commit is contained in:
Yann Weber 2017-03-09 00:12:24 +01:00
commit cacdfc3534
2 changed files with 7 additions and 1 deletions

View file

@ -392,6 +392,10 @@ for date format");
void ttail_free(ttail_t* t)
{
size_t i;
if(t->flag & TTAIL_FLAG_PREFIX && t->prefix_sz < 0)
{
regfree(&(t->date_prefix));
}
for(i=0; i<t->logfile_sz; i++)
{
if(t->logfile[i])
@ -403,6 +407,8 @@ void ttail_free(ttail_t* t)
free(t->logfile_name[i]);
}
}
free(t->logfile);
free(t->logfile_name);
t->logfile_sz = 0;
if(t->fmt != NULL)
{

View file

@ -51,8 +51,8 @@ void setup_closest_fileinit(void)
void teardown_closest_fileinit(void)
{
teardown_closest();
_ttail_search_file_free(ttail);
teardown_closest();
}
START_TEST (test_search_closest_init)