# Re: \[PATCH\] crypto: sm2 - fix a memory leak in sm2

- From: Herbert Xu \<herbert@gondor.apana.org.au\>
- Date: 2021-06-03 12:34:51 
- List: linux-crypto
- Page: https://ratatoskr.run/linux-crypto/2021/06/1401133
- Thread: https://ratatoskr.run/keyrings/2021/06/1401133/t.md

```text
On Tue, Jun 01, 2021 at 09:05:52PM +0800, Hongbo Li wrote:
> From: Hongbo Li <redacted>
> 
> SM2 module alloc ec->Q in sm2_set_pub_key(), when doing alg test in
> test_akcipher_one(), it will set public key for every test vector,
> and don't free ec->Q. This will cause a memory leak.
> 
> This patch alloc ec->Q in sm2_ec_ctx_init().
> 
> Fixes: ea7ecb66440b ("crypto: sm2 - introduce OSCCA SM2 asymmetric cipher algorithm")
> Signed-off-by: Hongbo Li <redacted>
> Cc: <redacted> # v5.10+
> Reviewed-by: Tianjia Zhang <redacted>
> ---
>  crypto/sm2.c | 24 ++++++++++--------------
>  1 file changed, 10 insertions(+), 14 deletions(-)

Your patch has been discarded by patchwork because you didn't
update the Subject.  The usual method is to use a version prefix
such as v2, v3, etc. so that the Subject remains distinct.

Please resubmit with a new Subject.

Oh and don't cc stable@vger.kernel.org.

Thanks,
-- 
Email: Herbert Xu [ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
```
