aboutsummaryrefslogtreecommitdiff
path: root/net/net.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/net.c')
-rw-r--r--net/net.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/net/net.c b/net/net.c
index 2afac24b79..fb7b7dcc25 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1213,10 +1213,9 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name,
Error **errp)
{
NetClientState *nc;
- RxFilterInfoList *filter_list = NULL, *last_entry = NULL;
+ RxFilterInfoList *filter_list = NULL, **tail = &filter_list;
QTAILQ_FOREACH(nc, &net_clients, next) {
- RxFilterInfoList *entry;
RxFilterInfo *info;
if (has_name && strcmp(nc->name, name) != 0) {
@@ -1241,15 +1240,7 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name,
if (nc->info->query_rx_filter) {
info = nc->info->query_rx_filter(nc);
- entry = g_malloc0(sizeof(*entry));
- entry->value = info;
-
- if (!filter_list) {
- filter_list = entry;
- } else {
- last_entry->next = entry;
- }
- last_entry = entry;
+ QAPI_LIST_APPEND(tail, info);
} else if (has_name) {
error_setg(errp, "net client(%s) doesn't support"
" rx-filter querying", name);