[openssl-commits] [openssl] OpenSSL_1_0_2-stable update

Matt Caswell matt at openssl.org
Mon May 23 23:14:16 UTC 2016


The branch OpenSSL_1_0_2-stable has been updated
       via  649af484c8a15ad916c101aba86c7529dac7eccb (commit)
      from  e117522e752478a1fbb87117e4660ee20b85acc2 (commit)


- Log -----------------------------------------------------------------
commit 649af484c8a15ad916c101aba86c7529dac7eccb
Author: Matt Caswell <matt at openssl.org>
Date:   Mon May 9 17:44:26 2016 +0100

    Fix a mem leak on an error path in OBJ_NAME_add()
    
    If lh_OBJ_NAME_insert() fails then the allocated |onp| value is leaked.
    
    RT#2238
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (cherry picked from commit 0a618df059d93bf7fe9e3ec92e04db8bc1eeff07)

-----------------------------------------------------------------------

Summary of changes:
 crypto/objects/o_names.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c
index 2485992..f106905 100644
--- a/crypto/objects/o_names.c
+++ b/crypto/objects/o_names.c
@@ -191,7 +191,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
     onp = (OBJ_NAME *)OPENSSL_malloc(sizeof(OBJ_NAME));
     if (onp == NULL) {
         /* ERROR */
-        return (0);
+        return 0;
     }
 
     onp->name = name;
@@ -216,10 +216,11 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
     } else {
         if (lh_OBJ_NAME_error(names_lh)) {
             /* ERROR */
-            return (0);
+            OPENSSL_free(onp);
+            return 0;
         }
     }
-    return (1);
+    return 1;
 }
 
 int OBJ_NAME_remove(const char *name, int type)


More information about the openssl-commits mailing list