From: Dmitry Belyavskiy <beldmit@gmail.com>
Date: Mon, 14 Oct 2019 15:00:34 +0000 (+0300)
Subject: Fix potential memory leak
X-Git-Tag: v3.0.0~263^2~3
X-Git-Url: http://wagner.pp.ru/gitweb/?a=commitdiff_plain;h=7f55249334f0dd265a3c2579812cbcec6c946944;p=openssl-gost%2Fengine.git

Fix potential memory leak

Fixes #180
---

diff --git a/gost_grasshopper_cipher.c b/gost_grasshopper_cipher.c
index ba353c2..9df7bbc 100644
--- a/gost_grasshopper_cipher.c
+++ b/gost_grasshopper_cipher.c
@@ -713,6 +713,7 @@ int gost_grasshopper_set_asn1_parameters(EVP_CIPHER_CTX *ctx, ASN1_TYPE *params)
     os = ASN1_OCTET_STRING_new();
 
     if (!os || !ASN1_OCTET_STRING_set(os, buf, len)) {
+        ASN1_OCTET_STRING_free(os);
         OPENSSL_free(buf);
         GOSTerr(GOST_F_GOST_GRASSHOPPER_SET_ASN1_PARAMETERS,
                 ERR_R_MALLOC_FAILURE);