diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
index 76410221d6a793b21148d016fc15e9b6f45bd997..944df1dd32f2cc8b87493ab73d21c9535d1a47a4 100644
--- a/libavfilter/af_atempo.c
+++ b/libavfilter/af_atempo.c
@@ -1148,6 +1148,8 @@ static int request_frame(AVFilterLink *outlink)
 
             if (n_out) {
                 ret = push_samples(atempo, outlink, n_out);
+                if (ret < 0)
+                    return ret;
             }
         }