diff options
-rw-r--r-- | block/qapi.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/block/qapi.c b/block/qapi.c index c8a45ec54c..164dd2b9a9 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -472,8 +472,14 @@ BlockInfoList *qmp_query_block(Error **errp) BlockBackend *blk; Error *local_err = NULL; - for (blk = blk_next(NULL); blk; blk = blk_next(blk)) { - BlockInfoList *info = g_malloc0(sizeof(*info)); + for (blk = blk_all_next(NULL); blk; blk = blk_all_next(blk)) { + BlockInfoList *info; + + if (!*blk_name(blk)) { + continue; + } + + info = g_malloc0(sizeof(*info)); bdrv_query_info(blk, &info->value, &local_err); if (local_err) { error_propagate(errp, local_err); |