}
iotcon_resource_types_destroy(resource->types);
- iotcon_observers_destroy(resource->observers);
+ if (resource->observers)
+ iotcon_observers_destroy(resource->observers);
free(resource->uri_path);
free(resource);
}
if (0 == resource->sub_id) {
WARN("Invalid Resource handle");
iotcon_resource_types_destroy(resource->types);
- iotcon_observers_destroy(resource->observers);
+ if (resource->observers)
+ iotcon_observers_destroy(resource->observers);
free(resource->uri_path);
free(resource);
return IOTCON_ERROR_NONE;