diff options
author | Tom Hughes <tom.hughes@palm.com> | 2010-12-22 00:52:07 +0300 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-12-22 21:32:20 +0300 |
commit | b38f4712c415d765d99fb9108b057d87e60242f4 (patch) | |
tree | 2a6a232af7c7889cd3bf5142778f1cce83d2f7ee /src | |
parent | 4b555091e42ec5e9d9568abead5011dea6c0be9b (diff) |
Fix memory leak in node_crypto.cc.
Both HexDecode and unbase64 allocate buffers, which weren't being freed.
Diffstat (limited to 'src')
-rw-r--r-- | src/node_crypto.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 3970a2a514f..639e99d0e26 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -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 |