commit
a69d552a005ba467d37e225032e35d01d9491241 upstream.
Catch the error condition in callers to avoid crashes.
Fixes: c156232a530b3 ("src: add comment support when adding tables")
Signed-off-by: Phil Sutter <phil@nwl.cc>
nlt = netlink_table_alloc(nlh);
t = netlink_delinearize_table(monh->ctx, nlt);
+ if (!t) {
+ nftnl_table_free(nlt);
+ return MNL_CB_ERROR;
+ }
cmd = netlink_msg2cmd(type, nlh->nlmsg_flags);
switch (monh->format) {
struct table *table;
table = netlink_delinearize_table(ctx, nlt);
- list_add_tail(&table->list, &ctx->list);
+ if (table)
+ list_add_tail(&table->list, &ctx->list);
return 0;
}