Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
crypto: fix DecipherUpdate() memory leak
Browse files Browse the repository at this point in the history
Fix a memory leak in the the code path that deals with partial hex strings.
  • Loading branch information
bnoordhuis committed Jul 8, 2012
1 parent 1c1ad9b commit 26f1bc8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/node_crypto.cc
Expand Up @@ -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;
}
Expand Down

0 comments on commit 26f1bc8

Please sign in to comment.