Delete mdsmap in descructor. Remove not needed checks for
mds_rank and objecter before call delete since the C++ standard
allows the deletion of pointer with NULL-value. The check is
redundant.
Fix for:
CID
1316224 (#1 of 1): Resource leak in object (CTOR_DTOR_LEAK)
1. alloc_new: Allocating memory by calling new MDSMap.
2. var_assign: Assigning: this->mdsmap = new MDSMap.
3. ctor_dtor_leak: The constructor allocates field mdsmap of MDSDaemon
but the destructor and whatever functions it calls do not free it.
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
MDSDaemon::~MDSDaemon() {
Mutex::Locker lock(mds_lock);
- if (mds_rank) {delete mds_rank ; mds_rank = NULL; }
- if (objecter) {delete objecter ; objecter = NULL; }
+ delete mds_rank;
+ mds_rank = NULL;
+ delete objecter;
+ objecter = NULL;
+ delete mdsmap;
+ mdsmap = NULL;
delete authorize_handler_service_registry;
delete authorize_handler_cluster_registry;