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:
reimar 2009-09-30 07:33:05 +00:00
parent d1b5f6efa1
commit f6f8acc19a
1 changed files with 3 additions and 0 deletions

View File

@ -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 *