From db8d99dbc2ae24c1481adb8f9d258a5c19605a77 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Tue, 2 Oct 2018 12:03:27 +0200 Subject: [PATCH] crypto: add virtual dtor to KeyPairGenerationConfig Currently the KeyPairGenerationConfigs class has a virtual function but no virtual destructor which means that if delete is called on a KeyPairGenerationConfig pointer to a derived instance, the derived destructor will not get called. The following warning is currently being printed when compiling: warning: delete called on 'node::crypto::KeyPairGenerationConfig' that is abstract but has non-virtual destructor [-Wdelete-non-virtual-dtor] delete __ptr; This commit adds a virtual destructor. PR-URL: https://github.com/nodejs/node/pull/23215 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung Reviewed-By: Benjamin Gruenbaum 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 1e5328f3d7afb3..23c5baebeda5b8 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -4845,6 +4845,7 @@ class KeyPairGenerationConfig { virtual bool Configure(const EVPKeyCtxPointer& ctx) { return true; } + virtual ~KeyPairGenerationConfig() {} }; class RSAKeyPairGenerationConfig : public KeyPairGenerationConfig {