[FFmpeg-cvslog] avformat/matroskadec: Use av_freep() to avoid leaving stale pointers in memory
Michael Niedermayer
git at videolan.org
Fri Jan 9 17:32:16 CET 2015
ffmpeg | branch: release/2.5 | Michael Niedermayer <michaelni at gmx.at> | Tue Jan 6 12:48:38 2015 +0100| [2791eba1d78af65884b1b02d482c930b1d301e54] | committer: Michael Niedermayer
avformat/matroskadec: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 6e70e4aca50696040cc9256ec96e5c31d9641432)
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2791eba1d78af65884b1b02d482c930b1d301e54
---
libavformat/matroskadec.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index e9ba1e9..3f327fd 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1080,7 +1080,7 @@ static void ebml_free(EbmlSyntax *syntax, void *data)
for (j = 0; j < list->nb_elem;
j++, ptr += syntax[i].list_elem_size)
ebml_free(syntax[i].def.n, ptr);
- av_free(list->elem);
+ av_freep(&list->elem);
} else
ebml_free(syntax[i].def.n, data_off);
default:
@@ -2134,7 +2134,7 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
{
if (matroska->num_packets > 0) {
memcpy(pkt, matroska->packets[0], sizeof(AVPacket));
- av_free(matroska->packets[0]);
+ av_freep(&matroska->packets[0]);
if (matroska->num_packets > 1) {
void *newpackets;
memmove(&matroska->packets[0], &matroska->packets[1],
@@ -2165,7 +2165,7 @@ static void matroska_clear_queue(MatroskaDemuxContext *matroska)
int n;
for (n = 0; n < matroska->num_packets; n++) {
av_free_packet(matroska->packets[n]);
- av_free(matroska->packets[n]);
+ av_freep(&matroska->packets[n]);
}
av_freep(&matroska->packets);
matroska->num_packets = 0;
@@ -3003,7 +3003,7 @@ static int matroska_read_close(AVFormatContext *s)
for (n = 0; n < matroska->tracks.nb_elem; n++)
if (tracks[n].type == MATROSKA_TRACK_TYPE_AUDIO)
- av_free(tracks[n].audio.buf);
+ av_freep(&tracks[n].audio.buf);
ebml_free(matroska_cluster, &matroska->current_cluster);
ebml_free(matroska_segment, matroska);
More information about the ffmpeg-cvslog
mailing list