input/logicport: Drop some unneeded allocation checks.

This commit is contained in:
Uwe Hermann 2018-05-17 21:09:48 +02:00
parent e1b115bd4d
commit 7102443a4a
1 changed files with 2 additions and 19 deletions

View File

@ -141,15 +141,8 @@ static struct signal_group_desc *alloc_signal_group(const char *name)
struct signal_group_desc *desc; struct signal_group_desc *desc;
desc = g_malloc0(sizeof(*desc)); desc = g_malloc0(sizeof(*desc));
if (!desc) if (name)
return NULL;
if (name) {
desc->name = g_strdup(name); desc->name = g_strdup(name);
if (!desc->name) {
g_free(desc);
return NULL;
}
}
return desc; return desc;
} }
@ -167,15 +160,8 @@ struct sr_channel_group *sr_channel_group_new(const char *name, void *priv)
struct sr_channel_group *cg; struct sr_channel_group *cg;
cg = g_malloc0(sizeof(*cg)); cg = g_malloc0(sizeof(*cg));
if (!cg) if (name && *name)
return NULL;
if (name && *name) {
cg->name = g_strdup(name); cg->name = g_strdup(name);
if (!cg->name) {
g_free(cg);
return NULL;
}
}
cg->priv = priv; cg->priv = priv;
return cg; return cg;
@ -1068,10 +1054,7 @@ static int init(struct sr_input *in, GHashTable *options)
(void)options; (void)options;
in->sdi = g_malloc0(sizeof(*in->sdi)); in->sdi = g_malloc0(sizeof(*in->sdi));
inc = g_malloc0(sizeof(*inc)); inc = g_malloc0(sizeof(*inc));
if (!inc)
return SR_ERR_MALLOC;
in->priv = inc; in->priv = inc;
return SR_OK; return SR_OK;