mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-08 16:54:49 +00:00
qemu: fix potential resource leak
Coverity reported a potential resource leak. While it's probably not a real-world scenario, the code could technically jump to cleanup between the time that vdpafd is opened and when it is used. Ensure that it gets cleaned up in that case. Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
c8c6991169
commit
e4648736be
@ -8145,6 +8145,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
|
|||||||
addfdarg = g_strdup_printf("%s,opaque=%s", fdset,
|
addfdarg = g_strdup_printf("%s,opaque=%s", fdset,
|
||||||
net->data.vdpa.devicepath);
|
net->data.vdpa.devicepath);
|
||||||
virCommandAddArgList(cmd, "-add-fd", addfdarg, NULL);
|
virCommandAddArgList(cmd, "-add-fd", addfdarg, NULL);
|
||||||
|
vdpafd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chardev)
|
if (chardev)
|
||||||
@ -8214,6 +8215,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
|
|||||||
VIR_FREE(tapfdName);
|
VIR_FREE(tapfdName);
|
||||||
VIR_FREE(vhostfd);
|
VIR_FREE(vhostfd);
|
||||||
VIR_FREE(tapfd);
|
VIR_FREE(tapfd);
|
||||||
|
VIR_FORCE_CLOSE(vdpafd);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user