From a8c145807ef5c67e923f1317a91d7111e14aed9f 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 8b3aa470a48e27..e5ea611eeb6d99 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -4837,6 +4837,7 @@ class KeyPairGenerationConfig { virtual bool Configure(const EVPKeyCtxPointer& ctx) { return true; } + virtual ~KeyPairGenerationConfig() {} }; class RSAKeyPairGenerationConfig : public KeyPairGenerationConfig {