mirror of https://github.com/mpv-player/mpv
Avoid a memleak if realloc fails in grow_array.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29734 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
d1b5f6efa1
commit
f6f8acc19a
|
@ -210,8 +210,11 @@ extern int dvdsub_id;
|
|||
*/
|
||||
static void grow_array(void *arrayp, int nelem, size_t elsize) {
|
||||
void **array = arrayp;
|
||||
void *oldp = *array;
|
||||
if (!(nelem & 31))
|
||||
*array = realloc(*array, (nelem + 32) * elsize);
|
||||
if (!*array)
|
||||
free(oldp);
|
||||
}
|
||||
|
||||
static mkv_track_t *
|
||||
|
|
Loading…
Reference in New Issue