]> git.sesse.net Git - ffmpeg/commit
avformat/dashdec: Fix memleaks on error to add representation to dynarray
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 19 Sep 2020 06:52:41 +0000 (08:52 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 21 Sep 2020 02:32:06 +0000 (04:32 +0200)
commitd63f8c873bd65f4dfab852069fb5faf07cffe6aa
tree82ed81f9a89f03280be03ecce5c8b5ade036d3d3
parentf1c3c173c9408085d7b26f3bdd264b426bca314a
avformat/dashdec: Fix memleaks on error to add representation to dynarray

Up until now, the DASH demuxer used av_dynarray_add() to add
audio/video/subtitles representations to arrays. Yet av_dynarray_add()
frees the array upon failure, leading to leaks of its elements;
furthermore, the element to be added leaks, too.

This has been fixed by using av_dynarray_add_nofree() instead and by
freeing the elements that could not be added to the list. Furthermore,
errors from this are now checked and returned.

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/dashdec.c