Browse Source

crypto: fix DecipherUpdate() memory leak

Fix a memory leak in the the code path that deals with partial hex strings.
v0.8.7-release
Ben Noordhuis 12 years ago
parent
commit
26f1bc8e8c
  1. 6
      src/node_crypto.cc

6
src/node_crypto.cc

@ -2641,10 +2641,8 @@ class Decipher : public ObjectWrap {
char* complete_hex = new char[len+2];
memcpy(complete_hex, &cipher->incomplete_hex, 1);
memcpy(complete_hex+1, buf, len);
if (alloc_buf) {
delete [] buf;
alloc_buf = false;
}
if (alloc_buf) delete [] buf;
alloc_buf = true;
buf = complete_hex;
len += 1;
}

Loading…
Cancel
Save