mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Decrement reference count
This commit is contained in:
parent
929dbba834
commit
b3d7823740
|
@ -4306,6 +4306,7 @@ PyInit__imaging(void) {
|
|||
m = PyModule_Create(&module_def);
|
||||
|
||||
if (setup_module(m) < 0) {
|
||||
Py_DECREF(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1090,6 +1090,7 @@ font_getvarnames(FontObject *self) {
|
|||
for (i = 0; i < name_count; i++) {
|
||||
error = FT_Get_Sfnt_Name(self->face, i, &name);
|
||||
if (error) {
|
||||
Py_DECREF(list_names);
|
||||
return geterror(error);
|
||||
}
|
||||
|
||||
|
@ -1136,6 +1137,11 @@ font_getvaraxes(FontObject *self) {
|
|||
|
||||
list_axis = PyDict_New();
|
||||
if (list_axis == NULL) {
|
||||
for (j = 0; j < i; j++) {
|
||||
list_axis = PyList_GetItem(list_axes, j);
|
||||
Py_DECREF(list_axis);
|
||||
}
|
||||
Py_DECREF(list_axes);
|
||||
return NULL;
|
||||
}
|
||||
PyDict_SetItemString(
|
||||
|
@ -1147,6 +1153,12 @@ font_getvaraxes(FontObject *self) {
|
|||
for (j = 0; j < name_count; j++) {
|
||||
error = FT_Get_Sfnt_Name(self->face, j, &name);
|
||||
if (error) {
|
||||
Py_DECREF(list_axis);
|
||||
for (j = 0; j < i; j++) {
|
||||
list_axis = PyList_GetItem(list_axes, j);
|
||||
Py_DECREF(list_axis);
|
||||
}
|
||||
Py_DECREF(list_axes);
|
||||
return geterror(error);
|
||||
}
|
||||
|
||||
|
|
|
@ -141,11 +141,13 @@ match(PyObject *self, PyObject *args) {
|
|||
}
|
||||
|
||||
if (!PyArg_ParseTuple(args, "On", &py_lut, &i0)) {
|
||||
Py_DECREF(ret);
|
||||
PyErr_SetString(PyExc_RuntimeError, "Argument parsing problem");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!PyBytes_Check(py_lut)) {
|
||||
Py_DECREF(ret);
|
||||
PyErr_SetString(PyExc_RuntimeError, "The morphology LUT is not a bytes object");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -153,6 +155,7 @@ match(PyObject *self, PyObject *args) {
|
|||
lut_len = PyBytes_Size(py_lut);
|
||||
|
||||
if (lut_len < LUT_SIZE) {
|
||||
Py_DECREF(ret);
|
||||
PyErr_SetString(PyExc_RuntimeError, "The morphology LUT has the wrong size");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -161,6 +164,7 @@ match(PyObject *self, PyObject *args) {
|
|||
imgin = (Imaging)i0;
|
||||
|
||||
if (imgin->type != IMAGING_TYPE_UINT8 || imgin->bands != 1) {
|
||||
Py_DECREF(ret);
|
||||
PyErr_SetString(PyExc_RuntimeError, "Unsupported image type");
|
||||
return NULL;
|
||||
}
|
||||
|
@ -221,6 +225,7 @@ get_on_pixels(PyObject *self, PyObject *args) {
|
|||
}
|
||||
|
||||
if (!PyArg_ParseTuple(args, "n", &i0)) {
|
||||
Py_DECREF(ret);
|
||||
PyErr_SetString(PyExc_RuntimeError, "Argument parsing problem");
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -58,5 +58,9 @@ PyInit__imagingtk(void) {
|
|||
};
|
||||
PyObject *m;
|
||||
m = PyModule_Create(&module_def);
|
||||
return (load_tkinter_funcs() == 0) ? m : NULL;
|
||||
if (load_tkinter_funcs() != 0) {
|
||||
Py_DECREF(m);
|
||||
return NULL;;
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
|
|
@ -987,6 +987,7 @@ PyInit__webp(void) {
|
|||
|
||||
m = PyModule_Create(&module_def);
|
||||
if (setup_module(m) < 0) {
|
||||
Py_DECREF(m);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user