If qmp_query_rx_filter() encounters an error on a second iteration, it leaks the memory from the first.
Fixes: 9083da1d4c Signed-off-by: Eric Blake <ebl...@redhat.com> --- net/net.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/net.c b/net/net.c index 794c652282cb..eb65e110871a 100644 --- a/net/net.c +++ b/net/net.c @@ -1213,6 +1213,7 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name, if (nc->info->type != NET_CLIENT_DRIVER_NIC) { if (has_name) { error_setg(errp, "net client(%s) isn't a NIC", name); + qapi_free_RxFilterInfoList(filter_list); return NULL; } continue; @@ -1238,6 +1239,7 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name, } else if (has_name) { error_setg(errp, "net client(%s) doesn't support" " rx-filter querying", name); + qapi_free_RxFilterInfoList(filter_list); return NULL; } -- 2.28.0