netconfig: Refactor rtnl error handling

Keep the rtnl destruction code in one place as it will have a
few more usages in the future.
This commit is contained in:
Tim Kourt 2019-07-16 17:49:43 -07:00 committed by Denis Kenzior
parent f1dd6b1084
commit 56670755c1
1 changed files with 8 additions and 8 deletions

View File

@ -604,24 +604,24 @@ static int netconfig_init(void)
if (!r) {
l_error("netconfig: Failed to register for RTNL link address"
" notifications.");
l_netlink_destroy(rtnl);
rtnl = NULL;
return r;
goto error;
}
r = rtnl_ifaddr_get(rtnl, netconfig_ifaddr_cmd_cb, NULL, NULL);
if (!r) {
l_error("netconfig: Failed to get addresses from RTNL link.");
l_netlink_destroy(rtnl);
rtnl = NULL;
return r;
goto error;
}
netconfig_list = l_queue_new();
return 0;
error:
l_netlink_destroy(rtnl);
rtnl = NULL;
return r;
}
static void netconfig_exit(void)