]> git.ipfire.org Git - thirdparty/openssl.git/commit
APPS: Add missing OPENSSL_free() and combine the error handler
authorJiasheng Jiang <jiasheng@purdue.edu>
Sat, 16 Mar 2024 21:27:14 +0000 (21:27 +0000)
committerTomas Mraz <tomas@openssl.org>
Tue, 9 Apr 2024 18:34:50 +0000 (20:34 +0200)
commitbeb82177ddcd4b536544ceec92bb53f4d85d8e91
treed9a938b0229ebbfd47daee0f2d4fd5ed8503af02
parentb3be6cc89e4dcfafe8f8be97e9519c26af2d19f5
APPS: Add missing OPENSSL_free() and combine the error handler

Add the OPENSSL_free() in the error handler to release the "*md_value"
allocated by app_malloc(). To make the code clear and avoid possible
future errors, combine the error handler in the "err" tag.
Then, we only need to use "goto err" instead of releasing the memory
separately.

Since the EVP_MD_get_size() may return negative numbers when an error occurs,
create_query() may fail to catch the error since it only considers 0 as an
error code.

Therefore, unifying the error codes of create_digest() from non-positive
numbers to 0 is better, which also benefits future programming.

Fixes: c7235be ("RFC 3161 compliant time stamp request creation, response generation and response verification.")
Signed-off-by: Jiasheng Jiang <jiasheng@purdue.edu>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/23873)
apps/ts.c