[syslog-ng] [PATCH] afmongodb: Only free the value pairs if there's any.

Gergely Nagy algernon at balabit.hu
Thu Dec 29 15:01:27 CET 2011


In afmongodb_dd_free() only free self->vp, if it is non-NULL. In case
of a syntax error in the configuration file, it may very well be NULL
still, and that would lead to us segfaulting shortly after printing
the error message.

Signed-off-by: Gergely Nagy <algernon at balabit.hu>
---
 modules/afmongodb/afmongodb.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/modules/afmongodb/afmongodb.c b/modules/afmongodb/afmongodb.c
index cbd0d16..7009b33 100644
--- a/modules/afmongodb/afmongodb.c
+++ b/modules/afmongodb/afmongodb.c
@@ -495,7 +495,8 @@ afmongodb_dd_free(LogPipe *d)
   g_free(self->user);
   g_free(self->password);
   g_free(self->host);
-  value_pairs_free(self->vp);
+  if (self->vp)
+    value_pairs_free(self->vp);
   log_dest_driver_free(d);
 }
 
-- 
1.7.7.3




More information about the syslog-ng mailing list