If an error condition occurs then the the decoder that was up-refed in
ossl_decoder_instance_new can be leaked.
Found due to the error report here:
https://github.com/openssl/openssl/pull/18355#issuecomment-
1138205688
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/18410)
ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_MALLOC_FAILURE);
return 0;
}
- if (!OSSL_DECODER_up_ref(decoder)) {
- ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_INTERNAL_ERROR);
- goto err;
- }
prov = OSSL_DECODER_get0_provider(decoder);
libctx = ossl_provider_libctx(prov);
= ossl_property_get_string_value(libctx, prop);
}
+ if (!OSSL_DECODER_up_ref(decoder)) {
+ ERR_raise(ERR_LIB_OSSL_DECODER, ERR_R_INTERNAL_ERROR);
+ goto err;
+ }
decoder_inst->decoder = decoder;
decoder_inst->decoderctx = decoderctx;
return decoder_inst;