diff -Nruw -x '*~' -x '\.*' syslog-ng-2.0.4/src/affile.c syslog-ng-2.0.4-mod/src/affile.c --- syslog-ng-2.0.4/src/affile.c 2007-04-20 07:37:16.000000000 +1200 +++ syslog-ng-2.0.4-mod/src/affile.c 2007-07-13 09:18:38.000000000 +1200 @@ -597,7 +597,11 @@ AFFileDestDriver *self = (AFFileDestDriver *) s; if (self->writer) + { log_pipe_deinit(self->writer, cfg, NULL); + log_pipe_unref(self->writer); + self->writer = NULL; + } if (self->writer_hash) g_hash_table_foreach_remove(self->writer_hash, affile_dd_remove_writers, self); if (self->reap_timer) diff -Nruw -x '*~' -x '\.*' syslog-ng-2.0.4/src/cfg-grammar.c syslog-ng-2.0.4-mod/src/cfg-grammar.c --- syslog-ng-2.0.4/src/cfg-grammar.c 2007-05-16 02:41:15.000000000 +1200 +++ syslog-ng-2.0.4-mod/src/cfg-grammar.c 2007-07-13 09:23:08.000000000 +1200 @@ -3035,8 +3035,6 @@ last_writer_options->template = log_template_new(NULL, (yyvsp[(3) - (4)].cptr)); last_writer_options->template->def_inline = TRUE; } - else - log_template_ref(last_writer_options->template); free((yyvsp[(3) - (4)].cptr)); } break; diff -Nruw -x '*~' -x '\.*' syslog-ng-2.0.4/src/cfg-grammar.y syslog-ng-2.0.4-mod/src/cfg-grammar.y --- syslog-ng-2.0.4/src/cfg-grammar.y 2007-04-21 08:24:08.000000000 +1200 +++ syslog-ng-2.0.4-mod/src/cfg-grammar.y 2007-07-13 09:23:24.000000000 +1200 @@ -677,8 +677,6 @@ last_writer_options->template = log_template_new(NULL, $3); last_writer_options->template->def_inline = TRUE; } - else - log_template_ref(last_writer_options->template); free($3); } | KW_TEMPLATE_ESCAPE '(' yesno ')' { log_writer_options_set_template_escape(last_writer_options, $3); } diff -Nruw -x '*~' -x '\.*' syslog-ng-2.0.4/src/templates.c syslog-ng-2.0.4-mod/src/templates.c --- syslog-ng-2.0.4/src/templates.c 2007-04-20 07:37:16.000000000 +1200 +++ syslog-ng-2.0.4-mod/src/templates.c 2007-07-13 09:22:02.000000000 +1200 @@ -123,6 +123,25 @@ } void +log_compiled_template_free(LogTemplate *self) +{ + GList* p; + LogTemplateElem *e; + + if (self->compiled_template) + { + for (p = self->compiled_template; p; p = g_list_first(p)) + { + e = p->data; + p = g_list_remove(p, e); + g_string_free(e->text, TRUE); + g_free(e); + } + self->compiled_template = NULL; + } +} + +void log_template_format(LogTemplate *self, LogMessage *lm, guint macro_flags, gint ts_format, glong zone_offset, gint frac_digits, GString *result) { GList *p; @@ -167,6 +186,7 @@ static void log_template_free(LogTemplate *self) { + log_compiled_template_free(self); g_string_free(self->name, TRUE); g_string_free(self->template, TRUE); g_free(self);