Skip to content

Commit 2ae9abb

Browse files
committed
Fix reference leak on buffer overflow
1 parent 680a111 commit 2ae9abb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Modules/fcntlmodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ fcntl_fcntl_impl(PyObject *module, int fd, int code, PyObject *arg)
136136
}
137137
if (ptr[len] != '\0') {
138138
PyErr_SetString(PyExc_SystemError, "buffer overflow");
139+
Py_DECREF(result);
139140
return NULL;
140141
}
141142
return result;
@@ -318,6 +319,7 @@ fcntl_ioctl_impl(PyObject *module, int fd, unsigned long code, PyObject *arg,
318319
}
319320
if (ptr[len] != '\0') {
320321
PyErr_SetString(PyExc_SystemError, "buffer overflow");
322+
Py_DECREF(result);
321323
return NULL;
322324
}
323325
return result;

0 commit comments

Comments
 (0)