aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-05-29 20:14:20 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2013-05-29 20:14:20 -0700
commitec0004aca0a2bf11f99c9587ddb2bf8ea818d3bb (patch)
tree26a2d7bb2bf1f99a837f3edb64cb9e806c5b5156
parent5a336768ca111ddc693f99ca9a6f445c2e467590 (diff)
parenta9280652ce61ddbbecfe16e18e1e464bb1f5d34d (diff)
Merge pull request #2671 from bytemaster/master
Fix Memory Leak
-rw-r--r--src/key.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/key.cpp b/src/key.cpp
index 20114e6bb2..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]);
@@ -367,6 +370,7 @@ bool CKey::SetCompactSignature(uint256 hash, const std::vector<unsigned char>& v
ECDSA_SIG_free(sig);
return true;
}
+ ECDSA_SIG_free(sig);
return false;
}