diff --git a/ffmpeg.c b/ffmpeg.c
index 6c22053c24a391f5d2dded30eb42c4df65745904..12db8a8c95ab00626696d548db87733712b9799f 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -2057,7 +2057,7 @@ static int av_encode(AVFormatContext **output_files,
                 av_free(ost->pict_tmp.data[0]);
                 if (ost->video_resample)
                     sws_freeContext(ost->img_resample_ctx);
-                if (ost->audio_resample)
+                if (ost->resample)
                     audio_resample_close(ost->resample);
                 av_free(ost);
             }