mirror of
				https://github.com/python/cpython.git
				synced 2025-10-30 21:21:22 +00:00 
			
		
		
		
	(Merge 3.3) Issue #15893: frozenmain.c now handles PyMem_Malloc() failure
This commit is contained in:
		
						commit
						597696c70c
					
				
					 1 changed files with 9 additions and 2 deletions
				
			
		|  | @ -20,9 +20,16 @@ Py_FrozenMain(int argc, char **argv) | ||||||
|     int inspect = 0; |     int inspect = 0; | ||||||
|     int unbuffered = 0; |     int unbuffered = 0; | ||||||
|     char *oldloc; |     char *oldloc; | ||||||
|     wchar_t **argv_copy = PyMem_Malloc(sizeof(wchar_t*)*argc); |     wchar_t **argv_copy; | ||||||
|     /* We need a second copies, as Python might modify the first one. */ |     /* We need a second copies, as Python might modify the first one. */ | ||||||
|     wchar_t **argv_copy2 = PyMem_Malloc(sizeof(wchar_t*)*argc); |     wchar_t **argv_copy2; | ||||||
|  | 
 | ||||||
|  |     argv_copy = PyMem_Malloc(sizeof(wchar_t*)*argc); | ||||||
|  |     argv_copy2 = PyMem_Malloc(sizeof(wchar_t*)*argc); | ||||||
|  |     if (!argv_copy || !argv_copy2) { | ||||||
|  |         fprintf(stderr, "out of memory\n"); | ||||||
|  |         return 1; | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     Py_FrozenFlag = 1; /* Suppress errors from getpath.c */ |     Py_FrozenFlag = 1; /* Suppress errors from getpath.c */ | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner