On Mon, 2013-01-14 at 15:09 +0800, Wenchao Xia wrote: > Now qemu-img call block layer function to get image info. > > Signed-off-by: Wenchao Xia <xiaw...@linux.vnet.ibm.com> > Reviewed-by: Eric Blake <ebl...@redhat.com> > --- > qemu-img.c | 86 +---------------------------------------------------------- > 1 files changed, 2 insertions(+), 84 deletions(-) > > diff --git a/qemu-img.c b/qemu-img.c > index 9dab48f..e20551a 100644 > --- a/qemu-img.c > +++ b/qemu-img.c > @@ -1338,6 +1257,7 @@ static ImageInfoList *collect_image_info_list(const > char *filename, > ImageInfoList *head = NULL; > ImageInfoList **last = &head; > GHashTable *filenames; > + Error *err = NULL; > > filenames = g_hash_table_new_full(g_str_hash, str_equal_func, NULL, > NULL); > > @@ -1359,9 +1279,7 @@ static ImageInfoList *collect_image_info_list(const > char *filename, > goto err; > } > > - info = g_new0(ImageInfo, 1); > - collect_image_info(bs, info, filename); > - collect_snapshots(bs, info); > + info = bdrv_query_image_info(bs, &err);
You are not using the 'err' variable so you should pass 'NULL' instead. info = bdrv_query_image_info(bs, NULL); > > elem = g_new0(ImageInfoList, 1); > elem->value = info;