# HG changeset patch # User reimar # Date 1160581657 0 # Node ID 2e7baee989ad3de4f262ac1c310b5a802f78e0af # Parent b9c036c1a7e135c492c6aab60862d8a347040701 Avoid memleak on error while reading attachments or multiple MATROSKA_ID_FILEDATA parts. diff -r b9c036c1a7e1 -r 2e7baee989ad libmpdemux/demux_mkv.c --- a/libmpdemux/demux_mkv.c Wed Oct 11 15:28:54 2006 +0000 +++ b/libmpdemux/demux_mkv.c Wed Oct 11 15:47:37 2006 +0000 @@ -1585,9 +1585,13 @@ int x; uint64_t num = ebml_read_length (s, &x); l = x + num; + free(data); data = malloc (num); if (stream_read(s, data, num) != (int) num) + { + free(data); return 0; + } data_size = num; mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + FileData, length " "%u\n", data_size);