[Python-checkins] cpython: Issue #27866: Fix refleak in cipher_to_dict()

victor.stinner python-checkins at python.org
Mon Sep 12 06:00:32 EDT 2016


https://hg.python.org/cpython/rev/2a1c7d0fdde6
changeset:   103702:2a1c7d0fdde6
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Mon Sep 12 12:00:23 2016 +0200
summary:
  Issue #27866: Fix refleak in cipher_to_dict()

files:
  Modules/_ssl.c |  13 +------------
  1 files changed, 1 insertions(+), 12 deletions(-)


diff --git a/Modules/_ssl.c b/Modules/_ssl.c
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -1587,12 +1587,6 @@
     int aead, nid;
     const char *skcipher = NULL, *digest = NULL, *kx = NULL, *auth = NULL;
 #endif
-    PyObject *retval;
-
-    retval = PyDict_New();
-    if (retval == NULL) {
-        goto error;
-    }
 
     /* can be NULL */
     cipher_name = SSL_CIPHER_get_name(cipher);
@@ -1616,7 +1610,7 @@
     auth = nid != NID_undef ? OBJ_nid2ln(nid) : NULL;
 #endif
 
-    retval = Py_BuildValue(
+    return Py_BuildValue(
         "{sksssssssisi"
 #if OPENSSL_VERSION_1_1
         "sOssssssss"
@@ -1636,11 +1630,6 @@
         "auth", auth
 #endif
        );
-    return retval;
-
-  error:
-    Py_XDECREF(retval);
-    return NULL;
 }
 #endif
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list