[syslog-ng] [PATCH] afmongodb: Fix a possible crash during configuration.

Gergely Nagy algernon at balabit.hu
Sun May 8 10:39:17 CEST 2011


During configuration, if the user specified value-pairs(), the driver
would crash, because it tried to free a NULL structure.

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 68594d7..422058e 100644
--- a/modules/afmongodb/afmongodb.c
+++ b/modules/afmongodb/afmongodb.c
@@ -148,7 +148,8 @@ afmongodb_dd_set_value_pairs(LogDriver *d, ValuePairs *vp)
 {
   MongoDBDestDriver *self = (MongoDBDestDriver *)d;
 
-  value_pairs_free (self->vp);
+  if (self->vp)
+    value_pairs_free (self->vp);
   self->vp = vp;
 }
 
-- 
1.7.2.5



More information about the syslog-ng mailing list