mirror of
				https://github.com/GrapheneOS/hardened_malloc.git
				synced 2025-10-30 07:46:32 +01:00 
			
		
		
		
	eliminate unnecessary code duplication in calloc
This commit is contained in:
		
							parent
							
								
									315415acf2
								
							
						
					
					
						commit
						58c7079db9
					
				
					 1 changed files with 1 additions and 9 deletions
				
			
		
							
								
								
									
										10
									
								
								malloc.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								malloc.c
									
										
									
									
									
								
							|  | @ -1081,17 +1081,9 @@ EXPORT void *h_calloc(size_t nmemb, size_t size) { | |||
|     init(); | ||||
|     thread_unseal_metadata(); | ||||
|     total_size = adjust_size_for_canaries(total_size); | ||||
|     if (ZERO_ON_FREE) { | ||||
|     void *p = allocate(total_size); | ||||
|     thread_seal_metadata(); | ||||
|         return p; | ||||
|     } | ||||
|     void *p = allocate(total_size); | ||||
|     thread_seal_metadata(); | ||||
|     if (unlikely(p == NULL)) { | ||||
|         return NULL; | ||||
|     } | ||||
|     if (size && size <= max_slab_size_class) { | ||||
|     if (!ZERO_ON_FREE && likely(p != NULL) && size && size <= max_slab_size_class) { | ||||
|         memset(p, 0, total_size - canary_size); | ||||
|     } | ||||
|     return p; | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue