]> git.sesse.net Git - ffmpeg/commit
avformat/dashdec: Fix leak of string on error when parsing representation
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sat, 19 Sep 2020 04:32:42 +0000 (06:32 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 21 Sep 2020 02:32:00 +0000 (04:32 +0200)
commite7aea1fe7304352c4b5359159700ab4957b10449
tree584569934fef654af5a9d0dc01044b2c4a2a0b2b
parent5c91701dc7f46975f9fb714d30c70a81dc0ce90a
avformat/dashdec: Fix leak of string on error when parsing representation

The DASH demuxer currently extracts several strings at once from an xml
document before processing them one by one; these strings are allocated,
stored in local variables and need to be freed by the demuxer itself.
So if an error happens when processing one of them, all strings need to
be freed before returning. This has simply not been done, leading to
leaks.

A simple fix would be to add the necessary code for freeing; yet there is
a better solution: Avoid having several strings at the same time by
extracting a string, processing it and immediately freeing it. That way
one only has to free at most one string on error.

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