crypto: avoid memory leak
Reviewed-By: Fedor Indutny <fedor@indutny.com>
This commit is contained in:
parent
92419f8762
commit
16b0a3393e
@ -4506,13 +4506,14 @@ void PBKDF2(const FunctionCallbackInfo<Value>& args) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
ASSERT_IS_BUFFER(args[1]);
|
||||
|
||||
pass = static_cast<char*>(malloc(passlen));
|
||||
if (pass == NULL) {
|
||||
FatalError("node::PBKDF2()", "Out of Memory");
|
||||
}
|
||||
memcpy(pass, Buffer::Data(args[0]), passlen);
|
||||
|
||||
ASSERT_IS_BUFFER(args[1]);
|
||||
saltlen = Buffer::Length(args[1]);
|
||||
if (saltlen < 0) {
|
||||
type_error = "Bad salt";
|
||||
|
Loading…
x
Reference in New Issue
Block a user