iotcon_resource_types_add(resource_types, CONV_RESOURCE_TYPE_TIZEN_D2D_SERVICE);
error = iotcon_resource_interfaces_create(&resource_ifaces);
-
- IF_FAIL_RETURN_TAG(error == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_OPERATION, _E, "ri creation failed");
+ IF_FAIL_CATCH_TAG(error == IOTCON_ERROR_NONE, _E, "ri creation failed");
iotcon_resource_interfaces_add(resource_ifaces, IOTCON_INTERFACE_DEFAULT);
error = iotcon_resource_create(CONV_URI_TIZEN_D2D_SERVICE, resource_types, resource_ifaces, properties, iotcon_request_cb, this, &iotcon_resource);
- IF_FAIL_RETURN_TAG(error == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_OPERATION, _E, "resource creation failed");
+ IF_FAIL_CATCH_TAG(error == IOTCON_ERROR_NONE, _E, "resource creation failed");
_D("device info registered as resource");
+
+CATCH:
iotcon_resource_types_destroy(resource_types);
iotcon_resource_interfaces_destroy(resource_ifaces);
+ IF_FAIL_RETURN(error == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_OPERATION);
return CONV_ERROR_NONE;
}
IF_FAIL_RETURN_TAG(error == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_OPERATION, _E, "resource destroy failed");
iotcon_resource = NULL;
-
_D("device info unregistered");
return CONV_ERROR_NONE;
}
_send_response(cb_info.request_handle, rep, IOTCON_RESPONSE_OK);
_D("Response sent");
+ iotcon_attributes_destroy(attributes);
+ iotcon_representation_destroy(rep);
+
bundle_free(p_bundle);
bundle_free(p_bundle_request);
app_control_cb_map.erase(find_iter);
iotcon_resource_types_add(resource_types, __resourceType.c_str());
error = iotcon_resource_interfaces_create(&resource_ifaces);
-
- IF_FAIL_RETURN_TAG(error == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_OPERATION, _E, "ri creation failed");
+ IF_FAIL_CATCH_TAG(error == IOTCON_ERROR_NONE, _E, "ri creation failed");
iotcon_resource_interfaces_add(resource_ifaces, IOTCON_INTERFACE_DEFAULT);
-
error = iotcon_resource_create(CONV_URI_REMOTE_APP_CONTROL, resource_types, resource_ifaces, properties, __iotcon_request_cb, NULL, &iotcon_resource);
- IF_FAIL_RETURN_TAG(error == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_OPERATION, _E, "resource creation failed");
+ IF_FAIL_CATCH_TAG(error == IOTCON_ERROR_NONE, _E, "resource creation failed");
+ _D("RemoteAppControlServiceProvider init done");
+CATCH:
iotcon_resource_types_destroy(resource_types);
iotcon_resource_interfaces_destroy(resource_ifaces);
+ IF_FAIL_RETURN(error == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_OPERATION);
- _D("RemoteAppControlServiceProvider init done");
} else {
_D("RemoteAppControlServiceProvider is already initiated");
}
iotcon_resource_types_add(resource_types, svcInfo->iotconInfoObj.resourceType.c_str());
error = iotcon_resource_interfaces_create(&resource_ifaces);
-
- IF_FAIL_RETURN_TAG(error == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_OPERATION, _E, "ri creation failed");
+ IF_FAIL_CATCH_TAG(error == IOTCON_ERROR_NONE, _E, "ri creation failed");
iotcon_resource_interfaces_add(resource_ifaces, IOTCON_INTERFACE_DEFAULT);
&(svcInfo->iotconInfoObj.iotconResourceHandle));
_D("remote resource created : %s, %s", svcInfo->iotconInfoObj.address.c_str(), svcInfo->iotconInfoObj.uri.c_str());
+ IF_FAIL_CATCH_TAG(error == IOTCON_ERROR_NONE, _E, "remote resource creation failed %s, %s", svcInfo->iotconInfoObj.address.c_str(), svcInfo->iotconInfoObj.uri.c_str());
- IF_FAIL_RETURN_TAG(error == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_OPERATION, _E, "remote resource creation failed %s, %s", svcInfo->iotconInfoObj.address.c_str(), svcInfo->iotconInfoObj.uri.c_str());
-
+CATCH:
iotcon_resource_types_destroy(resource_types);
iotcon_resource_interfaces_destroy(resource_ifaces);
+ IF_FAIL_RETURN(error == IOTCON_ERROR_NONE, CONV_ERROR_INVALID_OPERATION);
//send message for access request
iotcon_representation_h representation;