diff options
| author | Philip Kaufmann <[email protected]> | 2012-06-21 12:05:06 +0200 |
|---|---|---|
| committer | Philip Kaufmann <[email protected]> | 2012-06-21 14:43:13 +0200 |
| commit | a3d12f445ab17141c52a20bc53e6533a9410ccc9 (patch) | |
| tree | 28de2109a53b6bc0560cd74e8beca87886d71659 /src/key.cpp | |
| parent | Update my GPG key (diff) | |
| download | discoin-a3d12f445ab17141c52a20bc53e6533a9410ccc9.tar.xz discoin-a3d12f445ab17141c52a20bc53e6533a9410ccc9.zip | |
fix a memory leak in key.cpp
- add EC_KEY_free() in CKey::Reset() when pkey != NULL
- init pkey with NULL in CKey constructor
Diffstat (limited to 'src/key.cpp')
| -rw-r--r-- | src/key.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/key.cpp b/src/key.cpp index 57ab842bc..c943a38ea 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -129,6 +129,8 @@ void CKey::SetCompressedPubKey() void CKey::Reset() { fCompressedPubKey = false; + if (pkey != NULL) + EC_KEY_free(pkey); pkey = EC_KEY_new_by_curve_name(NID_secp256k1); if (pkey == NULL) throw key_error("CKey::CKey() : EC_KEY_new_by_curve_name failed"); @@ -137,6 +139,7 @@ void CKey::Reset() CKey::CKey() { + pkey = NULL; Reset(); } |