Commit d35e13b9e0 for ffmpeg
commit d35e13b9e05cc20f48373f88e399c8ef0c16fc61
Author: Sathvik Prabhu <sathvik.avenger@gmail.com>
Date: Wed Oct 21 03:55:50 2026 +0530
avformat/mov: fix memleak when spherical info is parsed more than once
mov_read_sv3d() and mov_read_vexu_proj() unconditionally assign
sc->spherical, leaking the previous allocation when a sample
description contains both an sv3d box and a vexu box with a proj
child, as in spherical-vexu-orientation.mp4 from the FATE suite.
Free any existing structure before allocating a new one. The last
box still wins, as before.
Signed-off-by: Sathvik Prabhu <sathvik.avenger@gmail.com>
diff --git a/libavformat/mov.c b/libavformat/mov.c
index f35334b064..eba7619ed1 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7367,6 +7367,7 @@ static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
}
+ av_freep(&sc->spherical);
sc->spherical = av_spherical_alloc(&sc->spherical_size);
if (!sc->spherical)
return AVERROR(ENOMEM);
@@ -7451,6 +7452,7 @@ static int mov_read_vexu_proj(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return AVERROR_INVALIDDATA;
}
+ av_freep(&sc->spherical);
sc->spherical = av_spherical_alloc(&sc->spherical_size);
if (!sc->spherical)
return AVERROR(ENOMEM);