CryptoPkg: RuntimeCryptLib: support realloc(NULL, size)
The ISO C standard says about realloc(), If ptr is a null pointer, the realloc function behaves like the malloc function for the specified size. The realloc() implementation doesn't conform to this currently, so add a check and call malloc() if appropriate. Cc: David Woodhouse <dwmw2@infradead.org> Cc: Qin Long <qin.long@intel.com> Cc: Ting Ye <ting.ye@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Qin Long <qin.long@intel.com>
This commit is contained in:
		@@ -396,6 +396,10 @@ void *realloc (void *ptr, size_t size)
 | 
				
			|||||||
  UINTN  StartPageIndex;
 | 
					  UINTN  StartPageIndex;
 | 
				
			||||||
  UINTN  PageCount;
 | 
					  UINTN  PageCount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (ptr == NULL) {
 | 
				
			||||||
 | 
					    return malloc (size);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Get Original Size of ptr
 | 
					  // Get Original Size of ptr
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user