[openssl/openssl] 48c2dc: Fix a possible memleak in bind_afalg

Bernd Edlinger noreply at github.com
Wed Jan 31 10:36:59 UTC 2024


  Branch: refs/heads/openssl-3.2
  Home:   https://github.com/openssl/openssl
  Commit: 48c2dc449211812922f6b0521494b0a436a43117
      https://github.com/openssl/openssl/commit/48c2dc449211812922f6b0521494b0a436a43117
  Author: Bernd Edlinger <bernd.edlinger at hotmail.de>
  Date:   2024-01-31 (Wed, 31 Jan 2024)

  Changed paths:
    M engines/e_afalg.c

  Log Message:
  -----------
  Fix a possible memleak in bind_afalg

bind_afalg calls afalg_aes_cbc which allocates
cipher_handle->_hidden global object(s)
but if one of them fails due to out of memory,
the function bind_afalg relies on the engine destroy
method to be called.  But that does not happen
because the dynamic engine object is not destroyed
in the usual way in dynamic_load in this case:

If the bind_engine function fails, there will be no
further calls into the shared object.
See ./crypto/engine/eng_dyn.c near the comment:
/* Copy the original ENGINE structure back */

Reviewed-by: Tom Cosgrove <tom.cosgrove at arm.com>
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23409)

(cherry picked from commit 729a1496cc4cda669dea6501c991113c78f04560)




More information about the openssl-commits mailing list