diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2016-01-25 21:20:35 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2016-01-25 21:20:35 +0000 |
commit | 80148955f82c205cc94f0112e0fbfe8f91bc4330 (patch) | |
tree | 252a0ae41cdb2ad3d798e311fb728b04e5bdbdbd /plugins/CryptoPP/src/cpp_keys.cpp | |
parent | a289103f2834d2219799f8d84e29a6d69c00574a (diff) |
Crypto++: Fix for many memory leaks introduced in [6593].
Note that replaceStr already does mir_strdup the argument!
git-svn-id: http://svn.miranda-ng.org/main/trunk@16168 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CryptoPP/src/cpp_keys.cpp')
-rw-r--r-- | plugins/CryptoPP/src/cpp_keys.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/CryptoPP/src/cpp_keys.cpp b/plugins/CryptoPP/src/cpp_keys.cpp index ec1659f179..37a197d70f 100644 --- a/plugins/CryptoPP/src/cpp_keys.cpp +++ b/plugins/CryptoPP/src/cpp_keys.cpp @@ -56,10 +56,14 @@ LPSTR __cdecl cpp_init_keya(HANDLE context, int features) }
memcpy((PVOID)&publ1[KEYSIZE], (PVOID)&send_features, 2);
+ mir_free(ptr->tmp);
if (ptr->mode & MODE_BASE64 || features & FEATURES_NEWPG)
- replaceStr(ptr->tmp, mir_base64_encode(publ1, KEYSIZE + 2));
- else
- replaceStr(ptr->tmp, base16encode((LPSTR)&publ1, KEYSIZE + 2));
+ ptr->tmp = mir_base64_encode(publ1, KEYSIZE + 2);
+ else {
+ char *base16 = base16encode((LPSTR)&publ1, KEYSIZE + 2);
+ ptr->tmp = mir_strdup(base16);
+ free(base16);
+ }
return ptr->tmp;
}
|