From 04f24881cb96825bb62f3857507c8401341cc2a4 Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Fri, 17 May 2019 16:48:58 -0600 Subject: [PATCH] Fix for potential leak on err: Thanks to Chris H. for the report --- wolfcrypt/src/asn.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 332ba7023..44d56fe4b 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -4156,8 +4156,10 @@ int wc_DsaKeyToDer(DsaKey* key, byte* output, word32 inLen) seqSz = SetSequence(verSz + intTotalLen, seq); outLen = seqSz + verSz + intTotalLen; - if (outLen > (int)inLen) + if (outLen > (int)inLen) { + FreeTmpDsas(tmps, key->heap); return BAD_FUNC_ARG; + } /* write to output */ XMEMCPY(output, seq, seqSz);