From: Michael Roth Date: Sun, 8 Nov 2020 14:37:41 +0000 (-0600) Subject: qga: fix missing closedir() in qmp_guest_get_disks() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b1b9ab1c04d560f86d8da3dfca4d8b21de75fee6;p=qemu.git qga: fix missing closedir() in qmp_guest_get_disks() We opendir("/sys/block") at the beginning of the function, but we never close it prior to returning. Fixes: Coverity CID 1436130 Fixes: fed3956429d5 ("qga: add implementation of guest-get-disks for Linux") Reported-by: Peter Maydell Cc: Marc-André Lureau Cc: Tomáš Golembiovský Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Michael Roth --- diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 3711080d07..12c1ba5ef7 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -1443,6 +1443,9 @@ GuestDiskInfoList *qmp_guest_get_disks(Error **errp) get_disk_deps(disk_dir, disk); ret = get_disk_partitions(ret, de->d_name, disk_dir, dev_name); } + + closedir(dp); + return ret; }