avformat/movenc: free sgpd_entries on the roll-distance error path

Found-by: Ao Xijie
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2026-06-29 01:35:05 +02:00
committed by michaelni
parent 9a01c1cb6a
commit b553b810c4

View File

@@ -3364,8 +3364,10 @@ static int mov_preroll_write_stbl_atoms(AVIOContext *pb, MOVTrack *track)
if (roll_samples_remaining > 0)
distance = 0;
/* Verify distance is a maximum of 32 (2.5ms) packets. */
if (distance > 32)
if (distance > 32) {
av_freep(&sgpd_entries);
return AVERROR_INVALIDDATA;
}
if (i && distance == sgpd_entries[entries].roll_distance) {
sgpd_entries[entries].count++;
} else {