On Fri, Dec 13, 2013 at 03:35:14PM +0800, Fam Zheng wrote: > +void bdrv_set_backing_hd(BlockDriverState *bs, BlockDriverState *backing_hd) > +{ > + if (bs->backing_hd) { > + bdrv_unref(bs->backing_hd); > + } > + > + bs->backing_hd = backing_hd; > + if (!backing_hd) { > + return; > + }
Maybe we should also do: bs->backing_file[0] = '\0'; bs->backing_format[0] = '\0';