From 4fd25823d16ccbe082ad3be9b96656296284d9b4 Mon Sep 17 00:00:00 2001 From: Dirk Farin Date: Thu, 30 Mar 2023 22:44:59 +0200 Subject: [PATCH] again fix the error that I just reintroduced (#801) --- libheif/plugins/heif_encoder_aom.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/libheif/plugins/heif_encoder_aom.cc b/libheif/plugins/heif_encoder_aom.cc index 6cac115325..692d11dba3 100644 --- a/libheif/plugins/heif_encoder_aom.cc +++ b/libheif/plugins/heif_encoder_aom.cc @@ -1004,6 +1004,11 @@ struct heif_error aom_encode_image(void* encoder_raw, const struct heif_image* i 0, // only encoding a single frame 1, 0); // no flags + + // Note: we are freeing the input image directly after use. + // This covers the usual success case and also all error cases that occur below. + aom_img_free(&input_image); + if (res != AOM_CODEC_OK) { err = { heif_error_Encoder_plugin_error, @@ -1014,15 +1019,6 @@ struct heif_error aom_encode_image(void* encoder_raw, const struct heif_image* i return err; } - - // Note: we are freeing the input image directly after use. - // This covers the usual success case and also all error cases that occur below. - aom_img_free(&input_image); - - if (err.code != heif_error_Ok) { - return err; - } - encoder->compressedData.clear(); const aom_codec_cx_pkt_t* pkt = NULL; aom_codec_iter_t iter = NULL; // for extracting the compressed packets