Mercurial > mplayer.hg
changeset 29692:235868858ee7
Avoid a memleak if realloc fails in grow_array.
author | reimar |
---|---|
date | Wed, 30 Sep 2009 07:33:05 +0000 |
parents | 183ea012e25b |
children | 328f17988caf |
files | libmpdemux/demux_mkv.c |
diffstat | 1 files changed, 3 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.c Wed Sep 30 07:27:43 2009 +0000 +++ b/libmpdemux/demux_mkv.c Wed Sep 30 07:33:05 2009 +0000 @@ -210,8 +210,11 @@ */ 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 *