From 0f458495c7d37c9e26130a8867b8015a623279d3 Mon Sep 17 00:00:00 2001 From: Gerardo Iglesias Galvan Date: Tue, 31 May 2011 17:49:20 -0500 Subject: [PATCH] Fix potential prelude recourse leak during initialization --- src/alert-prelude.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/alert-prelude.c b/src/alert-prelude.c index b250e6b99c..fbfc6a4ee6 100644 --- a/src/alert-prelude.c +++ b/src/alert-prelude.c @@ -858,8 +858,14 @@ OutputCtx *AlertPreludeInitCtx(ConfNode *conf) ctx->log_packet_header = 0; output_ctx = SCMalloc(sizeof(OutputCtx)); - if (output_ctx == NULL) - return NULL; + if (output_ctx == NULL) { + SCFree(ctx); + + prelude_perror(ret, "Unable to allocate memory"); + prelude_client_destroy(client, PRELUDE_CLIENT_EXIT_STATUS_SUCCESS); + SCReturnPtr(NULL, "AlertPreludeCtx"); + } + output_ctx->data = ctx; output_ctx->DeInit = AlertPreludeDeinitCtx;