virtio-net: fix the memory leak in rxfilter_notify()
object_get_canonical_path() returns a gchar*, it should be freed by the caller. Signed-off-by: Amos Kong <akong@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Vlad Yasevich <vyasevic@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
8b7acc79b9
commit
96e35046e4
|
@ -200,16 +200,16 @@ static void rxfilter_notify(NetClientState *nc)
|
||||||
VirtIONet *n = qemu_get_nic_opaque(nc);
|
VirtIONet *n = qemu_get_nic_opaque(nc);
|
||||||
|
|
||||||
if (nc->rxfilter_notify_enabled) {
|
if (nc->rxfilter_notify_enabled) {
|
||||||
|
gchar *path = object_get_canonical_path(OBJECT(n->qdev));
|
||||||
if (n->netclient_name) {
|
if (n->netclient_name) {
|
||||||
event_data = qobject_from_jsonf("{ 'name': %s, 'path': %s }",
|
event_data = qobject_from_jsonf("{ 'name': %s, 'path': %s }",
|
||||||
n->netclient_name,
|
n->netclient_name, path);
|
||||||
object_get_canonical_path(OBJECT(n->qdev)));
|
|
||||||
} else {
|
} else {
|
||||||
event_data = qobject_from_jsonf("{ 'path': %s }",
|
event_data = qobject_from_jsonf("{ 'path': %s }", path);
|
||||||
object_get_canonical_path(OBJECT(n->qdev)));
|
|
||||||
}
|
}
|
||||||
monitor_protocol_event(QEVENT_NIC_RX_FILTER_CHANGED, event_data);
|
monitor_protocol_event(QEVENT_NIC_RX_FILTER_CHANGED, event_data);
|
||||||
qobject_decref(event_data);
|
qobject_decref(event_data);
|
||||||
|
g_free(path);
|
||||||
|
|
||||||
/* disable event notification to avoid events flooding */
|
/* disable event notification to avoid events flooding */
|
||||||
nc->rxfilter_notify_enabled = 0;
|
nc->rxfilter_notify_enabled = 0;
|
||||||
|
|
Loading…
Reference in a new issue