see man asprintf
[...]
RETURN VALUE
When successful, these functions return the number of bytes printed, just like sprintf(3).
If memory allocation wasn't possible, or some other error occurs, these functions will return -1,
and the contents of strp is undefined.
Signed-off-by: Frank Meerkötter <frank@meerkoetter.org>
struct ubus_object *obj = &iface->ubus;
char *name = NULL;
- asprintf(&name, "%s.interface.%s", main_object.name, iface->name);
- if (!name)
+ if (asprintf(&name, "%s.interface.%s", main_object.name, iface->name) == -1)
return;
obj->name = name;