From 9624915443073c8ad61d1e0223571dc6f827ee22 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 29 Jul 2013 03:25:22 +0400 Subject: [PATCH] BUGFIX: SignCompact/SignCompactSignature memory leak --- src/key.cpp | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/key.cpp b/src/key.cpp index 23f3152..d9c2832 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -328,7 +328,10 @@ bool CKey::SignCompact(uint256 hash, std::vector& vchSig) } if (nRecId == -1) + { + ECDSA_SIG_free(sig); throw key_error("CKey::SignCompact() : unable to construct recoverable key"); + } vchSig[0] = nRecId+27+(fCompressedPubKey ? 4 : 0); BN_bn2bin(sig->r,&vchSig[33-(nBitsR+7)/8]); @@ -367,6 +370,7 @@ bool CKey::SetCompactSignature(uint256 hash, const std::vector& v ECDSA_SIG_free(sig); return true; } + ECDSA_SIG_free(sig); return false; } -- 1.7.1