Rework error handling of custom_ext_meth_add towards strong exception safety.
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Wed, 15 Feb 2017 10:36:17 +0000 (11:36 +0100)
committerRich Salz <rsalz@openssl.org>
Wed, 15 Feb 2017 13:42:20 +0000 (08:42 -0500)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2636)
(cherry picked from commit ed874fac6399d5064d6eb8fe2022b918aeaf75af)

ssl/t1_ext.c

index a8e9f9a9cdc09a109ecf66a9d0aefe4741864f2c..adcd0f9e88b31635e495c921ecc92994b4a67e5a 100644 (file)
@@ -181,12 +181,8 @@ static int custom_ext_meth_add(custom_ext_methods *exts,
     tmp = OPENSSL_realloc(exts->meths,
                           (exts->meths_count + 1) * sizeof(custom_ext_method));
 
-    if (tmp == NULL) {
-        OPENSSL_free(exts->meths);
-        exts->meths = NULL;
-        exts->meths_count = 0;
+    if (tmp == NULL)
         return 0;
-    }
 
     exts->meths = tmp;
     meth = exts->meths + exts->meths_count;