[openssl/openssl] 022e2d: Fix a possible memory leak in SM2 provider

AmosX noreply at github.com
Thu Nov 23 15:11:11 UTC 2023


  Branch: refs/heads/openssl-3.1
  Home:   https://github.com/openssl/openssl
  Commit: 022e2d56c7f8204f40949f2feebfd7781829ee98
      https://github.com/openssl/openssl/commit/022e2d56c7f8204f40949f2feebfd7781829ee98
  Author: Huiyue Xu <xuhuiyue at huawei.com>
  Date:   2023-11-23 (Thu, 23 Nov 2023)

  Changed paths:
    M providers/implementations/signature/sm2_sig.c

  Log Message:
  -----------
  Fix a possible memory leak in SM2 provider

ctx->propq that strdup from input parameter propq in sm2sig_newctx,
is not released. It should be released in sm2sig_freectx and copied
to dstctx in sm2sig_dupctx. And dstctx->id and dstctx->propq should
be set NULL to avoid releasing id/propq of srcctx when err occurs.

Signed-off-by: Huiyue Xu <xuhuiyue at huawei.com>

Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Matt Caswell <matt at openssl.org>
Reviewed-by: Paul Yang <kaishen.yy at antfin.com>
Reviewed-by: Hugo Landau <hlandau at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22796)

(cherry picked from commit e7d34d7ae32f16abbd79a49072cff580bee32269)




More information about the openssl-commits mailing list