]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Add return check to OSSL_DECODER_up_ref
authorNeil Horman <nhorman@openssl.org>
Fri, 17 Jul 2026 17:04:29 +0000 (13:04 -0400)
committerNorbert Pocs <norbertp@openssl.org>
Thu, 23 Jul 2026 08:24:01 +0000 (10:24 +0200)
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)

crypto/encode_decode/decoder_meth.c

index 03118f5843b50b9a5227eddcadc015b693bfa1be..632d20c996a4207b3c6ee292bb71e7e5a3f15d5b 100644 (file)
@@ -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
             }
         }