From d0895e9983d3ad3995d1ae8968767ef3b0f07aac Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Mon, 7 Oct 2024 08:30:59 +0200 Subject: [PATCH] Free metadata if subsequent allocation fails Credit: Oss-Fuzz Issue: https://issues.oss-fuzz.com/issues/42538223 --- src/flac/encode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/flac/encode.c b/src/flac/encode.c index 619ede87b2..ece960640c 100644 --- a/src/flac/encode.c +++ b/src/flac/encode.c @@ -1982,6 +1982,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio } if(!static_metadata_append(&static_metadata, p, /*needs_delete=*/true)) { flac__utils_printf(stderr, 1, "%s: ERROR allocating memory for foreign metadata block\n", e->inbasefilename); + FLAC__metadata_object_delete(p); static_metadata_clear(&static_metadata); return false; }