Change-Id: Ic5e182985b89ba4f46538597ff1623a208d38cfb
iotcon_interface_e iface, iotcon_representation_h repr)
{
RETV_IF(NULL == resp, IOTCON_ERROR_INVALID_PARAMETER);
- RETV_IF(NULL == repr, IOTCON_ERROR_INVALID_PARAMETER);
- resp->repr = repr;
+ if (resp->repr)
+ iotcon_representation_destroy(resp->repr);
resp->iface = iface;
- icl_representation_inc_ref_count(resp->repr);
+ resp->repr = repr;
+ if (repr)
+ icl_representation_inc_ref_count(resp->repr);
return IOTCON_ERROR_NONE;
}