d2d-conv-manager: fix svace issue 17/115217/1
authorHongkuk, Son <hongkuk.son@samsung.com>
Thu, 16 Feb 2017 04:39:02 +0000 (13:39 +0900)
committerHongkuk Son <hongkuk.son@samsung.com>
Fri, 17 Feb 2017 02:54:28 +0000 (18:54 -0800)
WID 20315689 - MEMORY_LEAK.EX

Signed-off-by: Hongkuk, Son <hongkuk.son@samsung.com>
Change-Id: I025866809513f80fc5d3df30141c1458eae06330
(cherry picked from commit 7a4c44b7140778747964e33b65ed793df7519c61)

daemon/discovery_provider/SmartviewDiscoveryProvider.cpp

index 394081a..8e86164 100755 (executable)
@@ -224,13 +224,20 @@ int conv::SmartviewDiscoveryProvider::notifyDiscovered(Service* service, bool bD
 
        // Covert MSF-API's Service into D2D Flow's Device n Service
        conv::SmartViewDevice*  conv_device = convertIntoConvDevice(service);
-       IF_FAIL_RETURN_TAG((conv_device != NULL), CONV_ERROR_INVALID_PARAMETER, _E, "failed to convert into flow device..");
+       if (conv_device == NULL) {
+               _E("failed to convert into flow device..");
+               return CONV_ERROR_INVALID_PARAMETER;
+       }
 
        conv::SmartViewService* conv_service = convertIntoConvService(service);
        if (conv_service == NULL) {
-               delete conv_device;
+               _E("failed to convert into flow service..");
+               if (conv_device != NULL) {
+                       delete conv_device;
+               }
+               return CONV_ERROR_INVALID_PARAMETER;
        }
-       IF_FAIL_RETURN_TAG((conv_service != NULL), CONV_ERROR_INVALID_PARAMETER, _E, "failed to convert into flow service..");
+
        conv_device->addService(conv_service);
 
        _D("Success in converting into flow.service[%x] .device[%x]", conv_service, conv_device);