Commit eac8ed4825 for openssl.org
commit eac8ed4825213a80644bb5ea15234a59daa57352
Author: Neil Horman <nhorman@openssl.org>
Date: Fri Jul 17 13:04:29 2026 -0400
Add return check to OSSL_DECODER_up_ref
Coverity flagged a location where we didn't check this return code, fix
it up.
Fixes https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1696759
Reviewed-by: Milan Broz <mbroz@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Jul 23 08:24:22 2026
(Merged from https://github.com/openssl/openssl/pull/31992)
diff --git a/crypto/encode_decode/decoder_meth.c b/crypto/encode_decode/decoder_meth.c
index 03118f5843..632d20c996 100644
--- a/crypto/encode_decode/decoder_meth.c
+++ b/crypto/encode_decode/decoder_meth.c
@@ -415,7 +415,10 @@ inner_ossl_decoder_fetch(struct decoder_data_st *methdata,
* lives beyond the freeing of that tmp_store
*/
#ifndef OPENSSL_NO_CACHED_FETCH
- OSSL_DECODER_up_ref((OSSL_DECODER *)method);
+ if (!OSSL_DECODER_up_ref((OSSL_DECODER *)method)) {
+ ossl_decoder_free(method);
+ method = NULL;
+ }
#endif
}
}