[openssl/openssl] a1d45a: APPS: Add missing OPENSSL_free() and combine the e...

JiashengJiang noreply at github.com
Tue Apr 9 18:38:59 UTC 2024


  Branch: refs/heads/openssl-3.2
  Home:   https://github.com/openssl/openssl
  Commit: a1d45a4217247b870024891bb88c19b2b1809567
      https://github.com/openssl/openssl/commit/a1d45a4217247b870024891bb88c19b2b1809567
  Author: Jiasheng Jiang <jiasheng at purdue.edu>
  Date:   2024-04-09 (Tue, 09 Apr 2024)

  Changed paths:
    M apps/ts.c

  Log Message:
  -----------
  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 at purdue.edu>

Reviewed-by: Neil Horman <nhorman at openssl.org>
Reviewed-by: Shane Lontis <shane.lontis at oracle.com>
(Merged from https://github.com/openssl/openssl/pull/23873)

(cherry picked from commit beb82177ddcd4b536544ceec92bb53f4d85d8e91)



To unsubscribe from these emails, change your notification settings at https://github.com/openssl/openssl/settings/notifications


More information about the openssl-commits mailing list