summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-18 11:46:28 +0100
committerwm4 <wm4@nowhere>2016-01-18 11:46:28 +0100
commit0ed170ec0b7483568ad82c936afee7803a533908 (patch)
treedf2023695f49d775dfd6c2c22aa1b58b9d399562 /demux
parent7b4ccb3e9f58a0745b58e473ee6e60b381242813 (diff)
downloadmpv-0ed170ec0b7483568ad82c936afee7803a533908.tar.bz2
mpv-0ed170ec0b7483568ad82c936afee7803a533908.tar.xz
sub: fix memory leaks
demux_lavf.c leaked the complete subtitle data if it was put through iconv. lavc_conv.c leaked AVCodecContext.subtitle_header (set by libavcodec), which is fixed by using avcodec_free_context(). It also leaked the subtitle that was decoded last.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_lavf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 1b3105170d..8cd525b685 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -282,6 +282,8 @@ static void convert_charset(struct demuxer *demuxer)
// libavformat transparently converts UTF-16 to UTF-8
if (!mp_charset_is_utf16(cp) && !mp_charset_is_utf8(cp)) {
bstr conv = mp_iconv_to_utf8(demuxer->log, data, cp, MP_ICONV_VERBOSE);
+ if (conv.start && conv.start != data.start)
+ talloc_steal(alloc, conv.start);
if (conv.start)
data = conv;
}