Add missing error checks found during code reading.
Most of these error conditions can only happen in low memory situations,
so there is no sane way to test them.
diff --git a/src/ssl/connection.c b/src/ssl/connection.c
index e10989b..5d6d008 100755
--- a/src/ssl/connection.c
+++ b/src/ssl/connection.c
@@ -819,10 +819,21 @@
return NULL;
lst = PyList_New(0);
+ if (lst == NULL) {
+ return NULL;
+ }
while ((ret = SSL_get_cipher_list(self->ssl, idx)) != NULL)
{
item = PyString_FromString(ret);
- PyList_Append(lst, item);
+ if (item == NULL) {
+ Py_DECREF(lst);
+ return NULL;
+ }
+ if (PyList_Append(lst, item)) {
+ Py_DECREF(lst);
+ Py_DECREF(item);
+ return NULL;
+ }
Py_DECREF(item);
idx++;
}