Browse Source

Merge pull request #2671 from bytemaster/master

Fix Memory Leak
miguelfreitas
Pieter Wuille 12 years ago
parent
commit
ec0004aca0
  1. 4
      src/key.cpp

4
src/key.cpp

@ -328,7 +328,10 @@ bool CKey::SignCompact(uint256 hash, std::vector<unsigned char>& vchSig)
} }
if (nRecId == -1) if (nRecId == -1)
{
ECDSA_SIG_free(sig);
throw key_error("CKey::SignCompact() : unable to construct recoverable key"); throw key_error("CKey::SignCompact() : unable to construct recoverable key");
}
vchSig[0] = nRecId+27+(fCompressedPubKey ? 4 : 0); vchSig[0] = nRecId+27+(fCompressedPubKey ? 4 : 0);
BN_bn2bin(sig->r,&vchSig[33-(nBitsR+7)/8]); 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); ECDSA_SIG_free(sig);
return true; return true;
} }
ECDSA_SIG_free(sig);
return false; return false;
} }

Loading…
Cancel
Save