mirror of https://github.com/nodejs/node.git
Fix memory leak in node_crypto.cc.
Both HexDecode and unbase64 allocate buffers, which weren't being freed.v0.7.4-release
parent
4b555091e4
commit
b38f4712c4
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue