mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-28 10:04:37 +08:00
avfilter/f_perms: free the input frame when it cannot be made writable or cloned
Fixes: 1MIkYBeZ4sTX Fixes: memleak Memory leak Replicated through Modified FFmpeg with LSan Found during triage of the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24765
This commit is contained in:
1 parent
88cd68c8fd
commit
f90f210d31
1 file changed
+6
-2
@@ -97,13 +97,17 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
in_perm == out_perm ? " (no-op)" : "");
|
||||
|
||||
if (in_perm == RO && out_perm == RW) {
|
||||
if ((ret = ff_inlink_make_frame_writable(inlink, &frame)) < 0)
|
||||
if ((ret = ff_inlink_make_frame_writable(inlink, &frame)) < 0) {
|
||||
av_frame_free(&frame);
|
||||
return ret;
|
||||
}
|
||||
out = frame;
|
||||
} else if (in_perm == RW && out_perm == RO) {
|
||||
out = av_frame_clone(frame);
|
||||
if (!out)
|
||||
if (!out) {
|
||||
av_frame_free(&frame);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
}
|
||||
|
||||
ret = ff_filter_frame(ctx->outputs[0], out);
|
||||
|
||||
Reference in new issue
Block a user