projects
/
platform
/
upstream
/
nodejs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1c1ad9b
)
crypto: fix DecipherUpdate() memory leak
author
Ben Noordhuis
<info@bnoordhuis.nl>
Fri, 6 Jul 2012 14:37:03 +0000
(16:37 +0200)
committer
Ben Noordhuis
<info@bnoordhuis.nl>
Sun, 8 Jul 2012 12:45:55 +0000
(14:45 +0200)
Fix a memory leak in the the code path that deals with partial hex strings.
src/node_crypto.cc
patch
|
blob
|
history
diff --git
a/src/node_crypto.cc
b/src/node_crypto.cc
index b09fbbb1dc26f96f27f8e309d2d8f9266a2ec819..8b21825a2bf572caa8b08fba2f869241a63bc425 100644
(file)
--- a/
src/node_crypto.cc
+++ b/
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;
}