Am 28.04.2014 um 04:57 hat Fam Zheng geschrieben: > bdrv_get_info could fail. Add check before using the returned value. > > Signed-off-by: Fam Zheng <f...@redhat.com> > > --- > V2: Handle error case (Stefan). > > Signed-off-by: Fam Zheng <f...@redhat.com> > --- > block/mirror.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/block/mirror.c b/block/mirror.c > index 2618c37..a3747e4 100644 > --- a/block/mirror.c > +++ b/block/mirror.c > @@ -339,7 +339,11 @@ static void coroutine_fn mirror_run(void *opaque) > bdrv_get_backing_filename(s->target, backing_filename, > sizeof(backing_filename)); > if (backing_filename[0] && !s->target->backing_hd) { > - bdrv_get_info(s->target, &bdi); > + ret = bdrv_get_info(s->target, &bdi); > + if (ret < 0) { > + block_job_completed(&s->common, ret); > + return; > + }
This leaks s->in_flight_bitmap and s->dirty_bitmap at least. The error path for the bdrv_getlength() call a few lines above probably needs a fix as well. Kevin