cli: add error checking to nl-route-get about out-of-memory
This is mainly to appease coverity which warned about this. Acked-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
d50758cbfe
commit
87682a093a
1 changed files with 6 additions and 2 deletions
|
@ -65,8 +65,12 @@ int main(int argc, char *argv[])
|
|||
};
|
||||
|
||||
m = nlmsg_alloc_simple(RTM_GETROUTE, 0);
|
||||
nlmsg_append(m, &rmsg, sizeof(rmsg), NLMSG_ALIGNTO);
|
||||
nla_put_addr(m, RTA_DST, dst);
|
||||
if (!m)
|
||||
nl_cli_fatal(ENOMEM, "out of memory");
|
||||
if (nlmsg_append(m, &rmsg, sizeof(rmsg), NLMSG_ALIGNTO) < 0)
|
||||
nl_cli_fatal(ENOMEM, "out of memory");
|
||||
if (nla_put_addr(m, RTA_DST, dst) < 0)
|
||||
nl_cli_fatal(ENOMEM, "out of memory");
|
||||
|
||||
err = nl_send_auto_complete(sock, m);
|
||||
nlmsg_free(m);
|
||||
|
|
Loading…
Add table
Reference in a new issue