Fix memory leak in CResourceFinder::onExecute. Delete resource handler
in case of Error.
Change-Id: I3d2363ed0b2585ffcbc403417fd73f60e89f1a88
Signed-off-by: Ankur Bansal <ankur.b1@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1490
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Minji Park <minjii.park@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
case RESOURCE_DISCOVER_REQUESTPROFILE:
pResource = (std::shared_ptr< OC::OCResource > *) pMessage[1];
pResourceHandler = new OICResourceHandler();
- SSM_CLEANUP_ASSERT(pResourceHandler->initHandler(*pResource, this));
+
+ res = pResourceHandler->initHandler(*pResource, this);
+ if(res != SSM_S_OK)
+ {
+ SAFE_DELETE(pResourceHandler);
+ SSM_CLEANUP_ASSERT(res);
+ }
resourceFullPath = pResource->get()->host() + pResource->get()->uri();