gh-87804: Fix the refleak in error handling of _pystatvfs_fromstructstatfs (#115335)

It was the macro expansion! Sorry!
This commit is contained in:
Nikita Sobolev 2024-02-12 19:27:27 +03:00 committed by GitHub
parent 91822018ee
commit 91bf01d4b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12916,14 +12916,15 @@ _pystatvfs_fromstructstatfs(PyObject *module, struct statfs st) {
_Static_assert(sizeof(st.f_blocks) == sizeof(long long), "assuming large file"); _Static_assert(sizeof(st.f_blocks) == sizeof(long long), "assuming large file");
#define SET_ITEM(v, index, item) \ #define SET_ITEM(SEQ, INDEX, EXPR) \
do { \ do { \
if (item == NULL) { \ PyObject *obj = (EXPR); \
Py_DECREF(v); \ if (obj == NULL) { \
return NULL; \ Py_DECREF((SEQ)); \
} \ return NULL; \
PyStructSequence_SET_ITEM(v, index, item); \ } \
} while (0) \ PyStructSequence_SET_ITEM((SEQ), (INDEX), obj); \
} while (0)
SET_ITEM(v, 0, PyLong_FromLong((long) st.f_iosize)); SET_ITEM(v, 0, PyLong_FromLong((long) st.f_iosize));
SET_ITEM(v, 1, PyLong_FromLong((long) st.f_bsize)); SET_ITEM(v, 1, PyLong_FromLong((long) st.f_bsize));