src: fix memory leak in DH key setters · nodejs/node@f237ad5 · GitHub
Skip to content

Commit f237ad5

Browse files
bnoordhuisaddaleax
authored andcommitted
src: fix memory leak in DH key setters
Fix a memory leak in dh.setPublicKey() and dh.setPrivateKey() where the old keys weren't freed. Fixes: #8377 PR-URL: #14122 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 0bbdb78 commit f237ad5

3 files changed

Lines changed: 53 additions & 29 deletions

File tree

src/node_crypto.cc

Lines changed: 25 additions & 29 deletions

src/node_crypto.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,8 @@ class DiffieHellman : public BaseObject {
692692
private:
693693
static void GetField(const v8::FunctionCallbackInfo<v8::Value>& args,
694694
BIGNUM* (DH::*field), const char* err_if_null);
695+
static void SetKey(const v8::FunctionCallbackInfo<v8::Value>& args,
696+
BIGNUM* (DH::*field), const char* what);
695697
bool VerifyContext();
696698

697699
bool initialised_;
Lines changed: 26 additions & 0 deletions

0 commit comments

Comments
 (0)