Fix memory leak in node_crypto.cc.

Both HexDecode and unbase64 allocate buffers, which weren't being freed.
v0.7.4-release
Tom Hughes 2010-12-21 15:52:07 -06:00 committed by Ryan Dahl
parent 4b555091e4
commit b38f4712c4
1 changed files with 2 additions and 2 deletions

View File

@ -1719,19 +1719,19 @@ class Decipher : public ObjectWrap {
if (alloc_buf) {
delete [] buf;
alloc_buf = false;
}
buf = ciphertext;
len = ciphertext_len;
alloc_buf = true;
} else if (strcasecmp(*encoding, "base64") == 0) {
unbase64((unsigned char*)buf, len, (char **)&ciphertext, &ciphertext_len);
if (alloc_buf) {
delete [] buf;
alloc_buf = false;
}
buf = ciphertext;
len = ciphertext_len;
alloc_buf = true;
} else if (strcasecmp(*encoding, "binary") == 0) {
// Binary - do nothing