From e7fed5fb1ea062b4c72d4e7907ae9e40518128e4 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Tue, 26 Nov 2019 04:18:35 +0100 Subject: [PATCH] Check return value from PyList_Append This fixes the correctness aspect of #17, although not the entire point. --- xattr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xattr.c b/xattr.c index 854beef..e118f79 100644 --- a/xattr.c +++ b/xattr.c @@ -645,7 +645,10 @@ get_all(PyObject *self, PyObject *args, PyObject *keywds) Py_DECREF(mylist); goto free_buf_val; } - PyList_Append(mylist, my_tuple); + if(PyList_Append(mylist, my_tuple) < 0) { + Py_DECREF(mylist); + goto free_buf_val; + } Py_DECREF(my_tuple); } -- 2.39.5