From 34547fc7f22022801a1d518a227ad16d63692b0b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 6 Jan 2026 07:19:41 +0000 Subject: [PATCH] Add null check for allocated frame Co-authored-by: PioLing <24726315+PioLing@users.noreply.github.com> --- src/Codec/Transcode.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Codec/Transcode.cpp b/src/Codec/Transcode.cpp index 5d575be5..58f27565 100644 --- a/src/Codec/Transcode.cpp +++ b/src/Codec/Transcode.cpp @@ -880,6 +880,10 @@ std::tuple FFmpegUtils::saveFrame(const FFmpegFrame::Ptr &fra auto pkt = alloc_av_packet(); auto filt_frame = alloc_av_frame(); + if (!filt_frame) { + ss << "Failed to allocate AVFrame"; + return make_tuple(false, ss.data()); + } while (av_buffersink_get_frame(buffersink_ctx, filt_frame.get()) >= 0) { if (avcodec_send_frame(jpeg_codec_ctx.get(), filt_frame.get()) == 0) { while (avcodec_receive_packet(jpeg_codec_ctx.get(), pkt.get()) == 0) {