diff options
author | Frank Meerkötter <frank@meerkoetter.org> | 2012-12-03 19:29:16 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-12-03 19:46:37 +0100 |
commit | a02432a5ecbb588964a1800122a213822da96f3c (patch) | |
tree | ef328c7fca26c47a611c964393488aaea6d32c2f /ubus.c | |
parent | c9242aed7daac67b338f6792b06afe78ffc57011 (diff) |
fix error checking of asprintf
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>
Diffstat (limited to 'ubus.c')
-rw-r--r-- | ubus.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -727,8 +727,7 @@ netifd_ubus_add_interface(struct interface *iface) 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; |