From 00a270848c7499c2cc46d53bad7db7d27e8ff8a3 Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Mon, 7 Oct 2024 14:28:05 +0200 Subject: [PATCH] Free metadata if subsequent allocation fails (#750) 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; }