Skip to content

Commit

Permalink
Merge pull request #11378 from lnicola/vsifree-null
Browse files Browse the repository at this point in the history
vsisimple: explicitly allow NULL in VSIFree and VSIRealloc
  • Loading branch information
rouault authored Nov 28, 2024
2 parents 4cfbcf8 + 6acebb7 commit 02c5966
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions port/cpl_vsisimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,10 @@ static void VSICheckMarkerEnd(char *ptr, size_t nEnd)
/* VSIRealloc() */
/************************************************************************/

/** Analog of realloc(). Use VSIFree() to free */
/** Analog of realloc(). Use VSIFree() to free.
*
* If the pointer is NULL, VSIRealloc is equivalent to VSIMalloc.
*/
void *VSIRealloc(void *pData, size_t nNewSize)

{
Expand Down Expand Up @@ -824,7 +827,11 @@ void *VSIRealloc(void *pData, size_t nNewSize)
/************************************************************************/

/** Analog of free() for data allocated with VSIMalloc(), VSICalloc(),
* VSIRealloc() */
* VSIRealloc().
*
* It is not an error to call VSIFree with a NULL pointer, and it will
* have no effect.
*/
void VSIFree(void *pData)

{
Expand Down

0 comments on commit 02c5966

Please sign in to comment.