mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 07:57:27 +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); |     m = PyModule_Create(&module_def); | ||||||
| 
 | 
 | ||||||
|     if (setup_module(m) < 0) { |     if (setup_module(m) < 0) { | ||||||
|  |         Py_DECREF(m); | ||||||
|         return NULL; |         return NULL; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1090,6 +1090,7 @@ font_getvarnames(FontObject *self) { | ||||||
|     for (i = 0; i < name_count; i++) { |     for (i = 0; i < name_count; i++) { | ||||||
|         error = FT_Get_Sfnt_Name(self->face, i, &name); |         error = FT_Get_Sfnt_Name(self->face, i, &name); | ||||||
|         if (error) { |         if (error) { | ||||||
|  |             Py_DECREF(list_names); | ||||||
|             return geterror(error); |             return geterror(error); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | @ -1136,6 +1137,11 @@ font_getvaraxes(FontObject *self) { | ||||||
| 
 | 
 | ||||||
|         list_axis = PyDict_New(); |         list_axis = PyDict_New(); | ||||||
|         if (list_axis == NULL) { |         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; |             return NULL; | ||||||
|         } |         } | ||||||
|         PyDict_SetItemString( |         PyDict_SetItemString( | ||||||
|  | @ -1147,6 +1153,12 @@ font_getvaraxes(FontObject *self) { | ||||||
|         for (j = 0; j < name_count; j++) { |         for (j = 0; j < name_count; j++) { | ||||||
|             error = FT_Get_Sfnt_Name(self->face, j, &name); |             error = FT_Get_Sfnt_Name(self->face, j, &name); | ||||||
|             if (error) { |             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); |                 return geterror(error); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -141,11 +141,13 @@ match(PyObject *self, PyObject *args) { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (!PyArg_ParseTuple(args, "On", &py_lut, &i0)) { |     if (!PyArg_ParseTuple(args, "On", &py_lut, &i0)) { | ||||||
|  |         Py_DECREF(ret); | ||||||
|         PyErr_SetString(PyExc_RuntimeError, "Argument parsing problem"); |         PyErr_SetString(PyExc_RuntimeError, "Argument parsing problem"); | ||||||
|         return NULL; |         return NULL; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (!PyBytes_Check(py_lut)) { |     if (!PyBytes_Check(py_lut)) { | ||||||
|  |         Py_DECREF(ret); | ||||||
|         PyErr_SetString(PyExc_RuntimeError, "The morphology LUT is not a bytes object"); |         PyErr_SetString(PyExc_RuntimeError, "The morphology LUT is not a bytes object"); | ||||||
|         return NULL; |         return NULL; | ||||||
|     } |     } | ||||||
|  | @ -153,6 +155,7 @@ match(PyObject *self, PyObject *args) { | ||||||
|     lut_len = PyBytes_Size(py_lut); |     lut_len = PyBytes_Size(py_lut); | ||||||
| 
 | 
 | ||||||
|     if (lut_len < LUT_SIZE) { |     if (lut_len < LUT_SIZE) { | ||||||
|  |         Py_DECREF(ret); | ||||||
|         PyErr_SetString(PyExc_RuntimeError, "The morphology LUT has the wrong size"); |         PyErr_SetString(PyExc_RuntimeError, "The morphology LUT has the wrong size"); | ||||||
|         return NULL; |         return NULL; | ||||||
|     } |     } | ||||||
|  | @ -161,6 +164,7 @@ match(PyObject *self, PyObject *args) { | ||||||
|     imgin = (Imaging)i0; |     imgin = (Imaging)i0; | ||||||
| 
 | 
 | ||||||
|     if (imgin->type != IMAGING_TYPE_UINT8 || imgin->bands != 1) { |     if (imgin->type != IMAGING_TYPE_UINT8 || imgin->bands != 1) { | ||||||
|  |         Py_DECREF(ret); | ||||||
|         PyErr_SetString(PyExc_RuntimeError, "Unsupported image type"); |         PyErr_SetString(PyExc_RuntimeError, "Unsupported image type"); | ||||||
|         return NULL; |         return NULL; | ||||||
|     } |     } | ||||||
|  | @ -221,6 +225,7 @@ get_on_pixels(PyObject *self, PyObject *args) { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (!PyArg_ParseTuple(args, "n", &i0)) { |     if (!PyArg_ParseTuple(args, "n", &i0)) { | ||||||
|  |         Py_DECREF(ret); | ||||||
|         PyErr_SetString(PyExc_RuntimeError, "Argument parsing problem"); |         PyErr_SetString(PyExc_RuntimeError, "Argument parsing problem"); | ||||||
|         return NULL; |         return NULL; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -58,5 +58,9 @@ PyInit__imagingtk(void) { | ||||||
|     }; |     }; | ||||||
|     PyObject *m; |     PyObject *m; | ||||||
|     m = PyModule_Create(&module_def); |     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); |     m = PyModule_Create(&module_def); | ||||||
|     if (setup_module(m) < 0) { |     if (setup_module(m) < 0) { | ||||||
|  |         Py_DECREF(m); | ||||||
|         return NULL; |         return NULL; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user