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@gmail.com>
This commit is contained in:
Gavin Kinsey 2012-06-26 19:00:30 +02:00 committed by Stefano Sabatini
parent 9ebed95db6
commit 37b5959d96
2 changed files with 2 additions and 2 deletions

View File

@ -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);

View File

@ -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);