VLC  3.0.0-git
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
Memory

Functions

static void * realloc_or_free (void *p, size_t sz)
 This wrapper around realloc() will free the input pointer when realloc() returns NULL.

Detailed Description

Function Documentation

static void* realloc_or_free ( void *  p,
size_t  sz 
)
inlinestatic

This wrapper around realloc() will free the input pointer when realloc() returns NULL.

The use case ptr = realloc(ptr, newsize) will cause a memory leak when ptr pointed to a heap allocation before, leaving the buffer allocated but unreferenced. vlc_realloc() is a drop-in replacement for that use case (and only that use case).

Referenced by AStreamPeekBlock(), AStreamPeekStream(), DownloadArt(), stream_ReadLine(), and vlc_config_create().