[FFmpeg-devel] [PATCH 06/15] avcodec/hw_base_encode: Simplify EOF check
Michael Niedermayer
michael at niedermayer.cc
Fri Jul 5 03:21:47 EEST 2024
Found while reviewing CID1608712 Explicit null dereferenced
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavcodec/hw_base_encode.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/libavcodec/hw_base_encode.c b/libavcodec/hw_base_encode.c
index ecb4be6aa43..6d5632c2988 100644
--- a/libavcodec/hw_base_encode.c
+++ b/libavcodec/hw_base_encode.c
@@ -546,11 +546,10 @@ start:
}
err = ff_encode_get_frame(avctx, frame);
- if (err < 0 && err != AVERROR_EOF)
- return err;
-
- if (err == AVERROR_EOF)
+ if (err == AVERROR_EOF) {
frame = NULL;
+ } else if (err < 0)
+ return err;
err = hw_base_encode_send_frame(avctx, ctx, frame);
if (err < 0)
--
2.45.2
More information about the ffmpeg-devel
mailing list