diff --git a/libavformat/avidec.c b/libavformat/avidec.c index f5b5c21a35..84ccaec5e3 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1295,12 +1295,12 @@ static int avi_read_close(AVFormatContext *s) AVIStream *ast = st->priv_data; av_free(st->codec->palctrl); if (ast) { - if (ast->sub_ctx) { - av_freep(&ast->sub_ctx->pb); - av_close_input_stream(ast->sub_ctx); - } - av_free(ast->sub_buffer); - av_free_packet(&ast->sub_pkt); + if (ast->sub_ctx) { + av_freep(&ast->sub_ctx->pb); + av_close_input_stream(ast->sub_ctx); + } + av_free(ast->sub_buffer); + av_free_packet(&ast->sub_pkt); } }