[PATCH] afmongodb: Only free the value pairs if there's any.
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@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
On Thu, 2011-12-29 at 15:01 +0100, Gergely Nagy wrote:
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@balabit.hu> --- modules/afmongodb/afmongodb.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
Thanks Gergely, applied to 3.3 -- Bazsi
participants (2)
-
Balazs Scheidler
-
Gergely Nagy