Kaydet (Commit) 524f1035 authored tarafından Hirokazu Yamamoto's avatar Hirokazu Yamamoto

Should call Py_INCREF for Py_None (Modules/_ssl.c: PySSL_cipher)

üst e239d23e
...@@ -928,10 +928,10 @@ static PyObject *PySSL_cipher (PySSLSocket *self) { ...@@ -928,10 +928,10 @@ static PyObject *PySSL_cipher (PySSLSocket *self) {
char *cipher_protocol; char *cipher_protocol;
if (self->ssl == NULL) if (self->ssl == NULL)
return Py_None; Py_RETURN_NONE;
current = SSL_get_current_cipher(self->ssl); current = SSL_get_current_cipher(self->ssl);
if (current == NULL) if (current == NULL)
return Py_None; Py_RETURN_NONE;
retval = PyTuple_New(3); retval = PyTuple_New(3);
if (retval == NULL) if (retval == NULL)
...@@ -939,6 +939,7 @@ static PyObject *PySSL_cipher (PySSLSocket *self) { ...@@ -939,6 +939,7 @@ static PyObject *PySSL_cipher (PySSLSocket *self) {
cipher_name = (char *) SSL_CIPHER_get_name(current); cipher_name = (char *) SSL_CIPHER_get_name(current);
if (cipher_name == NULL) { if (cipher_name == NULL) {
Py_INCREF(Py_None);
PyTuple_SET_ITEM(retval, 0, Py_None); PyTuple_SET_ITEM(retval, 0, Py_None);
} else { } else {
v = PyUnicode_FromString(cipher_name); v = PyUnicode_FromString(cipher_name);
...@@ -948,6 +949,7 @@ static PyObject *PySSL_cipher (PySSLSocket *self) { ...@@ -948,6 +949,7 @@ static PyObject *PySSL_cipher (PySSLSocket *self) {
} }
cipher_protocol = SSL_CIPHER_get_version(current); cipher_protocol = SSL_CIPHER_get_version(current);
if (cipher_protocol == NULL) { if (cipher_protocol == NULL) {
Py_INCREF(Py_None);
PyTuple_SET_ITEM(retval, 1, Py_None); PyTuple_SET_ITEM(retval, 1, Py_None);
} else { } else {
v = PyUnicode_FromString(cipher_protocol); v = PyUnicode_FromString(cipher_protocol);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment