From 59a51a88bdf39f0f84319fcfe715c3b6792771d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vivek=20Das=C2=A0Mohapatra?= <vivek@collabora.co.uk>
Date: Fri, 19 May 2017 20:07:39 +0100
Subject: [PATCH] Always exit through the free/cleanup path in
 capsule_shim_dlopen

---
 capsule/capsule-dlmopen.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/capsule/capsule-dlmopen.c b/capsule/capsule-dlmopen.c
index 1eb53e060..755a08688 100644
--- a/capsule/capsule-dlmopen.c
+++ b/capsule/capsule-dlmopen.c
@@ -1475,7 +1475,7 @@ capsule_shim_dlopen(Lmid_t ns,
                     const char *file,
                     int flag)
 {
-    void *res;
+    void *res = NULL;
     int code = 0;
     char *errors = NULL;
     ldlibs_t ldlibs = { 0 };
@@ -1518,11 +1518,10 @@ capsule_shim_dlopen(Lmid_t ns,
         res = load_ldlibs( &ldlibs, &ns, flag, &code, &errors );
 
         if( !res )
-        {
             DEBUG( DEBUG_WRAPPERS,
                    "capsule dlopen error %d: %s", code, errors );
-            goto cleanup;
-        }
+
+        goto cleanup;
     }
     else // no prefix: straightforward dlmopen into our capsule namespace:
     {
-- 
GitLab