lib: fix error code from nfnl_exp_build_message()

Otherwise we return success but don't actually set the output
result. This can lead to a crash, in case of out-of-memory.

Found by Coverity.

https://bugzilla.redhat.com/show_bug.cgi?id=1606988
This commit is contained in:
Thomas Haller 2019-08-27 14:58:35 +02:00
parent 34708e2ef0
commit f3d5c44d21

View File

@ -492,6 +492,8 @@ static int nfnl_exp_build_message(const struct nfnl_exp *exp, int cmd, int flags
return 0;
nla_put_failure:
err = -NLE_NOMEM;
err_out:
nlmsg_free(msg);
return err;