diff --git a/src/node_crypto.cc b/src/node_crypto.cc index a922be66087..329ca9c4bbe 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -4506,13 +4506,14 @@ void PBKDF2(const FunctionCallbackInfo& args) { goto err; } + ASSERT_IS_BUFFER(args[1]); + pass = static_cast(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";