ch->index = index;
ch->type = type;
ch->enabled = enabled;
- if (name)
+ if (name && *name)
ch->name = g_strdup(name);
sdi->channels = g_slist_append(sdi->channels, ch);
{
if (!channel)
return SR_ERR_ARG;
+ if (!name || !*name)
+ return SR_ERR_ARG;
g_free(channel->name);
channel->name = g_strdup(name);
if (!sdi || sdi->inst_type != SR_INST_USER || index < 0)
return SR_ERR_ARG;
- sr_channel_new(sdi, index, type, TRUE, name);
+ if (!sr_channel_new(sdi, index, type, TRUE, name))
+ return SR_ERR_DATA;
return SR_OK;
}