On Tue, 3 Nov 2020 at 02:45, Michael Roth <michael.r...@amd.com> wrote: > > From: Tomáš Golembiovský <tgole...@redhat.com> > > The command lists all disks (real and virtual) as well as disk > partitions. For each disk the list of dependent disks is also listed and > /dev path is used as a handle so it can be matched with "name" field of > other returned disk entries. For disk partitions the "dependents" list > is populated with the the parent device for easier tracking of > hierarchy.
Hi; Coverity points out a resource leak in this function (CID 1436130): > +GuestDiskInfoList *qmp_guest_get_disks(Error **errp) > +{ > + GuestDiskInfoList *item, *ret = NULL; > + GuestDiskInfo *disk; > + DIR *dp = NULL; > + struct dirent *de = NULL; > + > + g_debug("listing /sys/block directory"); > + dp = opendir("/sys/block"); Here we opendir()... > + if (dp == NULL) { > + error_setg_errno(errp, errno, "Can't open directory \"/sys/block\""); > + return NULL; > + } > + while ((de = readdir(dp)) != NULL) { [stuff] > + } > + return ret; ...but we forget to closedir() it again. > +} thanks -- PMM