Skip to content

Commit 92bf471

Browse files
author
Bartosz Golaszewski
committed
Check the return value of PyCapsule_New()
PyCapsule_New() can fail and return NULL. Check the return value and go right to OUT on failure.
1 parent b330bcc commit 92bf471

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

fuseparts/_fusemodule.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,8 +1273,13 @@ poll_func(const char *path, struct fuse_file_info *fi,
12731273
{
12741274
PyObject *pollhandle = Py_None;
12751275

1276-
if (ph)
1276+
if (ph) {
12771277
pollhandle = PyCapsule_New(ph, pollhandle_name, pollhandle_destructor);
1278+
if (!pollhandle) {
1279+
PyErr_Print();
1280+
goto OUT;
1281+
}
1282+
}
12781283

12791284
#ifdef FIX_PATH_DECODING
12801285
PROLOGUE(PYO_CALLWITHFI(fi, poll_cb, O&O, &Path_AsDecodedUnicode, path, pollhandle));

0 commit comments

Comments
 (0)