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:
9475ee4
)
crypto: fix memory leak in randomBytes() error path
author
Ben Noordhuis
<info@bnoordhuis.nl>
Fri, 16 Aug 2013 14:42:50 +0000
(16:42 +0200)
committer
Ben Noordhuis
<info@bnoordhuis.nl>
Fri, 16 Aug 2013 14:47:30 +0000
(16:47 +0200)
src/node_crypto.cc
patch
|
blob
|
history
diff --git
a/src/node_crypto.cc
b/src/node_crypto.cc
index
665010b
..
0344d20
100644
(file)
--- a/
src/node_crypto.cc
+++ b/
src/node_crypto.cc
@@
-3422,7
+3422,7
@@
void RandomBytesCheck(RandomBytesRequest* req, Local<Value> argv[2]) {
if (req->error_) {
char errmsg[256] = "Operation not supported";
- if (req->error_ !=
(unsigned long) -1
)
+ if (req->error_ !=
static_cast<unsigned long>(-1)
)
ERR_error_string_n(req->error_, errmsg, sizeof errmsg);
argv[0] = Exception::Error(OneByteString(node_isolate, errmsg));
@@
-3430,7
+3430,9
@@
void RandomBytesCheck(RandomBytesRequest* req, Local<Value> argv[2]) {
} else {
argv[0] = Null(node_isolate);
argv[1] = Buffer::Use(req->data_, req->size_);
+ req->data_ = NULL;
}
+ free(req->data_);
}