Commit 50a28b13 authored by Stefano Sabatini's avatar Stefano Sabatini

doc/examples: do not check NULL values for avcodec_close()

avcodec_close() does nothing in case the argument is NULL. Simplify.
parent 98786aa2
......@@ -369,10 +369,8 @@ int main (int argc, char **argv)
}
end:
if (video_dec_ctx)
avcodec_close(video_dec_ctx);
if (audio_dec_ctx)
avcodec_close(audio_dec_ctx);
avcodec_close(video_dec_ctx);
avcodec_close(audio_dec_ctx);
avformat_close_input(&fmt_ctx);
if (video_dst_file)
fclose(video_dst_file);
......
......@@ -248,8 +248,7 @@ int main(int argc, char **argv)
}
end:
avfilter_graph_free(&filter_graph);
if (dec_ctx)
avcodec_close(dec_ctx);
avcodec_close(dec_ctx);
avformat_close_input(&fmt_ctx);
av_frame_free(&frame);
av_frame_free(&filt_frame);
......
......@@ -237,8 +237,7 @@ int main(int argc, char **argv)
}
end:
avfilter_graph_free(&filter_graph);
if (dec_ctx)
avcodec_close(dec_ctx);
avcodec_close(dec_ctx);
avformat_close_input(&fmt_ctx);
av_frame_free(&frame);
av_frame_free(&filt_frame);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment