summaryrefslogtreecommitdiffstats
path: root/doc/examples
diff options
context:
space:
mode:
authorZhao Zhili <wantlamy@gmail.com>2018-05-14 20:18:01 +0800
committerMichael Niedermayer <michael@niedermayer.cc>2018-05-16 00:39:52 +0200
commitf24b2e64b0f328d321b56ab6119d8398380f0557 (patch)
tree6bbcca3945ac38e43afd821c46a42645a0b4b2b7 /doc/examples
parentc0a845f9481dc62d92ea020eb0695e3f73f8c476 (diff)
downloadffmpeg-streaming-f24b2e64b0f328d321b56ab6119d8398380f0557.zip
ffmpeg-streaming-f24b2e64b0f328d321b56ab6119d8398380f0557.tar.gz
examples/filtering_video: fix memory leak
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/filtering_video.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c
index 5a314b3..105a200 100644
--- a/doc/examples/filtering_video.c
+++ b/doc/examples/filtering_video.c
@@ -211,18 +211,21 @@ int main(int argc, char **argv)
{
int ret;
AVPacket packet;
- AVFrame *frame = av_frame_alloc();
- AVFrame *filt_frame = av_frame_alloc();
+ AVFrame *frame;
+ AVFrame *filt_frame;
- if (!frame || !filt_frame) {
- perror("Could not allocate frame");
- exit(1);
- }
if (argc != 2) {
fprintf(stderr, "Usage: %s file\n", argv[0]);
exit(1);
}
+ frame = av_frame_alloc();
+ filt_frame = av_frame_alloc();
+ if (!frame || !filt_frame) {
+ perror("Could not allocate frame");
+ exit(1);
+ }
+
if ((ret = open_input_file(argv[1])) < 0)
goto end;
if ((ret = init_filters(filter_descr)) < 0)
OpenPOWER on IntegriCloud