Skip to content

Commit 02c5966

Browse files
authored
Merge pull request #11378 from lnicola/vsifree-null
vsisimple: explicitly allow NULL in VSIFree and VSIRealloc
2 parents 4cfbcf8 + 6acebb7 commit 02c5966

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

port/cpl_vsisimple.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,10 @@ static void VSICheckMarkerEnd(char *ptr, size_t nEnd)
675675
/* VSIRealloc() */
676676
/************************************************************************/
677677

678-
/** Analog of realloc(). Use VSIFree() to free */
678+
/** Analog of realloc(). Use VSIFree() to free.
679+
*
680+
* If the pointer is NULL, VSIRealloc is equivalent to VSIMalloc.
681+
*/
679682
void *VSIRealloc(void *pData, size_t nNewSize)
680683

681684
{
@@ -824,7 +827,11 @@ void *VSIRealloc(void *pData, size_t nNewSize)
824827
/************************************************************************/
825828

826829
/** Analog of free() for data allocated with VSIMalloc(), VSICalloc(),
827-
* VSIRealloc() */
830+
* VSIRealloc().
831+
*
832+
* It is not an error to call VSIFree with a NULL pointer, and it will
833+
* have no effect.
834+
*/
828835
void VSIFree(void *pData)
829836

830837
{

0 commit comments

Comments
 (0)