Skip to content

Commit

Permalink
crypto: add virtual dtor to KeyPairGenerationConfig
Browse files Browse the repository at this point in the history
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: #23215
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
danbev authored and jasnell committed Oct 17, 2018
1 parent 288c033 commit 5f93676
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4837,6 +4837,7 @@ class KeyPairGenerationConfig {
virtual bool Configure(const EVPKeyCtxPointer& ctx) {
return true;
}
virtual ~KeyPairGenerationConfig() {}
};

class RSAKeyPairGenerationConfig : public KeyPairGenerationConfig {
Expand Down

0 comments on commit 5f93676

Please sign in to comment.