mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-30 23:47:27 +03:00 
			
		
		
		
	Use ImagingError_MemoryError NULL return value
This commit is contained in:
		
							parent
							
								
									75542fea6d
								
							
						
					
					
						commit
						b7fb39fff8
					
				|  | @ -2711,8 +2711,7 @@ _font_getmask(ImagingFontObject* self, PyObject* args) | |||
|     im = ImagingNew(self->bitmap->mode, textwidth(self, text), self->ysize); | ||||
|     if (!im) { | ||||
|         free(text); | ||||
|         ImagingError_MemoryError(); | ||||
|         return NULL; | ||||
|         return ImagingError_MemoryError(); | ||||
|     } | ||||
| 
 | ||||
|     b = 0; | ||||
|  | @ -3933,8 +3932,7 @@ _set_blocks_max(PyObject* self, PyObject* args) | |||
| 
 | ||||
| 
 | ||||
|     if ( ! ImagingMemorySetBlocksMax(&ImagingDefaultArena, blocks_max)) { | ||||
|         ImagingError_MemoryError(); | ||||
|         return NULL; | ||||
|         return ImagingError_MemoryError(); | ||||
|     } | ||||
| 
 | ||||
|     Py_INCREF(Py_None); | ||||
|  |  | |||
|  | @ -1005,8 +1005,7 @@ static unsigned int* get_qtables_arrays(PyObject* qtables, int* qtablesLen) { | |||
|     qarrays = (unsigned int*) malloc(num_tables * DCTSIZE2 * sizeof(unsigned int)); | ||||
|     if (!qarrays) { | ||||
|         Py_DECREF(tables); | ||||
|         ImagingError_MemoryError(); | ||||
|         return NULL; | ||||
|         return ImagingError_MemoryError(); | ||||
|     } | ||||
|     for (i = 0; i < num_tables; i++) { | ||||
|         table = PySequence_Fast_GET_ITEM(tables, i); | ||||
|  |  | |||
|  | @ -53,12 +53,10 @@ alloc_array(Py_ssize_t count) | |||
| { | ||||
|     double* xy; | ||||
|     if (count < 0) { | ||||
|         ImagingError_MemoryError(); | ||||
|         return NULL; | ||||
|         return ImagingError_MemoryError(); | ||||
|     } | ||||
|     if ((unsigned long long)count > (SIZE_MAX / (2 * sizeof(double))) - 1 ) { | ||||
|         ImagingError_MemoryError(); | ||||
|         return NULL; | ||||
|         return ImagingError_MemoryError(); | ||||
|     } | ||||
|     xy = malloc(2 * count * sizeof(double) + 1); | ||||
|     if (!xy) { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user