From ed2a7fbcfec6612c1e303c1c0a98ffae91be0d1c Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 10 Jul 2017 12:56:37 +0200 Subject: [PATCH] src: guard against double free in randomBytes() PR-URL: https://github.com/nodejs/node/pull/14122 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- src/node_crypto.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 248a701cb3..b9fd2446e2 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -5498,6 +5498,7 @@ class RandomBytesRequest : public AsyncWrap { size_ = 0; if (free_mode_ == FREE_DATA) { free(data_); + data_ = nullptr; } }