[FFmpeg-cvslog] examples/filtering: fix packet memleak
Gavin Kinsey
git at videolan.org
Tue Jun 26 19:05:06 CEST 2012
ffmpeg | branch: master | Gavin Kinsey <gkinsey at ad-holdings.co.uk> | Tue Jun 26 19:00:30 2012 +0200| [37b5959d9689f5310640c7a0beaa7784c58bfa6f] | committer: Stefano Sabatini
examples/filtering: fix packet memleak
Free packets unconditionally after demuxing, and not only when the
packets belong to a given stream.
Signed-off-by: Stefano Sabatini <stefasab at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=37b5959d9689f5310640c7a0beaa7784c58bfa6f
---
doc/examples/filtering_audio.c | 2 +-
doc/examples/filtering_video.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/examples/filtering_audio.c b/doc/examples/filtering_audio.c
index cca28e9..4d96438 100644
--- a/doc/examples/filtering_audio.c
+++ b/doc/examples/filtering_audio.c
@@ -195,7 +195,6 @@ int main(int argc, char **argv)
avcodec_get_frame_defaults(&frame);
got_frame = 0;
ret = avcodec_decode_audio4(dec_ctx, &frame, &got_frame, &packet);
- av_free_packet(&packet);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error decoding audio\n");
continue;
@@ -222,6 +221,7 @@ int main(int argc, char **argv)
}
}
}
+ av_free_packet(&packet);
}
end:
avfilter_graph_free(&filter_graph);
diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c
index 0cf23be..4bede05 100644
--- a/doc/examples/filtering_video.c
+++ b/doc/examples/filtering_video.c
@@ -199,7 +199,6 @@ int main(int argc, char **argv)
avcodec_get_frame_defaults(&frame);
got_frame = 0;
ret = avcodec_decode_video2(dec_ctx, &frame, &got_frame, &packet);
- av_free_packet(&packet);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error decoding video\n");
break;
@@ -229,6 +228,7 @@ int main(int argc, char **argv)
}
}
}
+ av_free_packet(&packet);
}
end:
avfilter_graph_free(&filter_graph);
More information about the ffmpeg-cvslog
mailing list