From: Lin Ma Date: Thu, 13 Sep 2018 07:54:24 +0000 (+0800) Subject: util: Return a virArpTablePtr when the nlmsghdr for loop is over X-Git-Tag: v4.8.0-rc1~185 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=317e3b28656d0685ca88667e52b81df44799ae8c;p=thirdparty%2Flibvirt.git util: Return a virArpTablePtr when the nlmsghdr for loop is over commit b00c9c39 removed the label end_of_netlink_messages and 'return table' statement, It causes the function virArpTableGet doesn't return a proper virArpTable pointer. How to reproduce: # virsh domiflist sles12sp3 Interface Type Source Model MAC ------------------------------------------------------- vnet0 network default virtio 52:54:00:cd:02:e6 # virsh domifaddr sles12sp3 --source arp error: Failed to query for interfaces addresses error: An error occurred, but the cause is unknown It seems that the "if (nh->nlmsg_type == NLMSG_DONE)" statement won't be meted. So this patch adds 'return table' when the iterations of nlmsghdr for loop is over. Signed-off-by: Lin Ma Reviewed-by: Chen Hanxiao Reviewed-by: John Ferlan --- diff --git a/src/util/virarptable.c b/src/util/virarptable.c index 04a6f35571..217a960d5a 100644 --- a/src/util/virarptable.c +++ b/src/util/virarptable.c @@ -152,6 +152,8 @@ virArpTableGet(void) } } + return table; + cleanup: virArpTableFree(table); return NULL;