diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 3711080d0752bb0c6df4596081bd30d6c1ef8f12..12c1ba5ef79d257de703196a9fe62eadc16402eb 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;
 }