This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 03931e8865 libavfilter/vf_amf_common: free the frame allocated by 
av_frame_alloc on error
03931e8865 is described below

commit 03931e88650bb353ecae1a3f45ae176fa5363114
Author:     jiangjie <[email protected]>
AuthorDate: Mon Apr 27 20:13:15 2026 +0800
Commit:     ArazIusubov <[email protected]>
CommitDate: Tue Apr 28 14:57:34 2026 +0000

    libavfilter/vf_amf_common: free the frame allocated by av_frame_alloc on 
error
---
 libavfilter/vf_amf_common.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_amf_common.c b/libavfilter/vf_amf_common.c
index eb3aceabc1..e18c858eda 100644
--- a/libavfilter/vf_amf_common.c
+++ b/libavfilter/vf_amf_common.c
@@ -400,8 +400,7 @@ AVFrame *amf_amfsurface_to_avframe(AVFilterContext *avctx, 
AMFSurface* pSurface)
             int ret = av_hwframe_get_buffer(ctx->hwframes_out_ref, frame, 0);
             if (ret < 0) {
                 av_log(avctx, AV_LOG_ERROR, "Get hw frame failed.\n");
-                av_frame_free(&frame);
-                return NULL;
+                goto fail;
             }
             frame->data[0] = (uint8_t *)pSurface;
             frame->buf[1] = av_buffer_create((uint8_t *)pSurface, 
sizeof(AMFSurface),
@@ -410,7 +409,7 @@ AVFrame *amf_amfsurface_to_avframe(AVFilterContext *avctx, 
AMFSurface* pSurface)
                                             AV_BUFFER_FLAG_READONLY);
         } else { // FIXME: add processing of other hw formats
             av_log(ctx, AV_LOG_ERROR, "Unknown pixel format\n");
-            return NULL;
+            goto fail;
         }
     } else {
 
@@ -448,13 +447,16 @@ AVFrame *amf_amfsurface_to_avframe(AVFilterContext 
*avctx, AMFSurface* pSurface)
         default:
             {
                 av_log(avctx, AV_LOG_ERROR, "Unsupported memory type : %d\n", 
pSurface->pVtbl->GetMemoryType(pSurface));
-                return NULL;
+                goto fail;
             }
         }
     }
 
 
     return frame;
+fail:
+    av_frame_free(&frame);
+    return NULL;
 }
 
 int amf_avframe_to_amfsurface(AVFilterContext *avctx, const AVFrame *frame, 
AMFSurface** ppSurface)

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to