aboutsummaryrefslogtreecommitdiff
path: root/src/key.cpp
diff options
context:
space:
mode:
authorDaniel Larimer <dlarimer@gmail.com>2013-05-19 15:46:11 -0400
committerDaniel Larimer <dlarimer@gmail.com>2013-05-19 15:46:11 -0400
commita9280652ce61ddbbecfe16e18e1e464bb1f5d34d (patch)
tree3eebdabb38e612af2ff1a951b3ffed86197fe180 /src/key.cpp
parent173601705ccf189fd83e3854f71f6a872c6faeda (diff)
Fix memory leak on exception in Key::SignCompact
Diffstat (limited to 'src/key.cpp')
-rw-r--r--src/key.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/key.cpp b/src/key.cpp
index 74b2797d83..75114c6afe 100644
--- a/src/key.cpp
+++ b/src/key.cpp
@@ -328,7 +328,10 @@ bool CKey::SignCompact(uint256 hash, std::vector<unsigned char>& 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]);