This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 4d46eeed02428e29ddce51e80c31c73e8c6a7f01 Author: Zhao Zhili <[email protected]> AuthorDate: Tue Dec 23 00:32:44 2025 +0800 Commit: Zhao Zhili <[email protected]> CommitDate: Fri Jan 2 23:45:52 2026 +0800 avfilter/vf_libopencv: fix memleak Signed-off-by: Zhao Zhili <[email protected]> --- libavfilter/vf_libopencv.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavfilter/vf_libopencv.c b/libavfilter/vf_libopencv.c index 8a80a7fdab..bc8fd0bad5 100644 --- a/libavfilter/vf_libopencv.c +++ b/libavfilter/vf_libopencv.c @@ -36,9 +36,9 @@ #include "formats.h" #include "video.h" -static void fill_iplimage_from_frame(IplImage *img, const AVFrame *frame, enum AVPixelFormat pixfmt) +static void fill_iplimage_from_frame(IplImage **_img, const AVFrame *frame, enum AVPixelFormat pixfmt) { - IplImage *tmpimg; + IplImage *img; int depth, channels_nb; if (pixfmt == AV_PIX_FMT_GRAY8) { depth = IPL_DEPTH_8U; channels_nb = 1; } @@ -46,8 +46,7 @@ static void fill_iplimage_from_frame(IplImage *img, const AVFrame *frame, enum A else if (pixfmt == AV_PIX_FMT_BGR24) { depth = IPL_DEPTH_8U; channels_nb = 3; } else return; - tmpimg = cvCreateImageHeader((CvSize){frame->width, frame->height}, depth, channels_nb); - *img = *tmpimg; + *_img = img = cvCreateImageHeader((CvSize){frame->width, frame->height}, depth, channels_nb); img->imageData = img->imageDataOrigin = frame->data[0]; img->dataOrder = IPL_DATA_ORDER_PIXEL; img->origin = IPL_ORIGIN_TL; @@ -366,7 +365,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) OCVContext *s = ctx->priv; AVFilterLink *outlink= inlink->dst->outputs[0]; AVFrame *out; - IplImage inimg, outimg; + IplImage *inimg, *outimg; out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { @@ -377,10 +376,12 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) fill_iplimage_from_frame(&inimg , in , inlink->format); fill_iplimage_from_frame(&outimg, out, inlink->format); - s->end_frame_filter(ctx, &inimg, &outimg); - fill_frame_from_iplimage(out, &outimg, inlink->format); + s->end_frame_filter(ctx, inimg, outimg); + fill_frame_from_iplimage(out, outimg, inlink->format); av_frame_free(&in); + cvReleaseImageHeader(&inimg); + cvReleaseImageHeader(&outimg); return ff_filter_frame(outlink, out); } _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
