]> git.proxmox.com Git - mirror_qemu.git/blobdiff - monitor.c
block: Fix bdrv_next() memory leak
[mirror_qemu.git] / monitor.c
index 6a32b9bf5977efc1ccfbb079cee13581a576eb6e..404d594bb38f1ec7db4f33d82de4957d6930bd5f 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -3432,12 +3432,12 @@ static void vm_completion(ReadLineState *rs, const char *str)
 {
     size_t len;
     BlockDriverState *bs;
-    BdrvNextIterator *it = NULL;
+    BdrvNextIterator it;
 
     len = strlen(str);
     readline_set_completion_index(rs, len);
 
-    while ((it = bdrv_next(it, &bs))) {
+    for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
         SnapshotInfoList *snapshots, *snapshot;
         AioContext *ctx = bdrv_get_aio_context(bs);
         bool ok = false;