Blob Blame History Raw
From 5b84837757cab93397cfa5830e69d2b7e7ce0e0c Mon Sep 17 00:00:00 2001
From: Jerry Snitselaar <jsnitsel@redhat.com>
Date: Wed, 18 Oct 2017 21:46:45 -0700
Subject: [PATCH] lib: clean up potential memory leak

In case where sapi_ctx_init fails in sapi_init_from_options, free tcti_ctx.

Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
 lib/context-util.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/context-util.c b/lib/context-util.c
index 7de22ac..c3034f9 100644
--- a/lib/context-util.c
+++ b/lib/context-util.c
@@ -205,8 +205,10 @@ sapi_init_from_options (common_opts_t *options)
     if (tcti_ctx == NULL)
         return NULL;
     sapi_ctx = sapi_ctx_init (tcti_ctx);
-    if (sapi_ctx == NULL)
+    if (sapi_ctx == NULL) {
+        free (tcti_ctx);
         return NULL;
+    }
     return sapi_ctx;
 }
 /*
-- 
2.15.0.rc0