mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 07:57: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); |     im = ImagingNew(self->bitmap->mode, textwidth(self, text), self->ysize); | ||||||
|     if (!im) { |     if (!im) { | ||||||
|         free(text); |         free(text); | ||||||
|         ImagingError_MemoryError(); |         return ImagingError_MemoryError(); | ||||||
|         return NULL; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     b = 0; |     b = 0; | ||||||
|  | @ -3933,8 +3932,7 @@ _set_blocks_max(PyObject* self, PyObject* args) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     if ( ! ImagingMemorySetBlocksMax(&ImagingDefaultArena, blocks_max)) { |     if ( ! ImagingMemorySetBlocksMax(&ImagingDefaultArena, blocks_max)) { | ||||||
|         ImagingError_MemoryError(); |         return ImagingError_MemoryError(); | ||||||
|         return NULL; |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     Py_INCREF(Py_None); |     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)); |     qarrays = (unsigned int*) malloc(num_tables * DCTSIZE2 * sizeof(unsigned int)); | ||||||
|     if (!qarrays) { |     if (!qarrays) { | ||||||
|         Py_DECREF(tables); |         Py_DECREF(tables); | ||||||
|         ImagingError_MemoryError(); |         return ImagingError_MemoryError(); | ||||||
|         return NULL; |  | ||||||
|     } |     } | ||||||
|     for (i = 0; i < num_tables; i++) { |     for (i = 0; i < num_tables; i++) { | ||||||
|         table = PySequence_Fast_GET_ITEM(tables, i); |         table = PySequence_Fast_GET_ITEM(tables, i); | ||||||
|  |  | ||||||
|  | @ -53,12 +53,10 @@ alloc_array(Py_ssize_t count) | ||||||
| { | { | ||||||
|     double* xy; |     double* xy; | ||||||
|     if (count < 0) { |     if (count < 0) { | ||||||
|         ImagingError_MemoryError(); |         return ImagingError_MemoryError(); | ||||||
|         return NULL; |  | ||||||
|     } |     } | ||||||
|     if ((unsigned long long)count > (SIZE_MAX / (2 * sizeof(double))) - 1 ) { |     if ((unsigned long long)count > (SIZE_MAX / (2 * sizeof(double))) - 1 ) { | ||||||
|         ImagingError_MemoryError(); |         return ImagingError_MemoryError(); | ||||||
|         return NULL; |  | ||||||
|     } |     } | ||||||
|     xy = malloc(2 * count * sizeof(double) + 1); |     xy = malloc(2 * count * sizeof(double) + 1); | ||||||
|     if (!xy) { |     if (!xy) { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user