Am 02.10.2014 um 11:04 hat Markus Armbruster geschrieben:
> Convenience function blk_new_with_bs() creates a BlockBackend with its
> BlockDriverState.  Callers have to unref both.  The commit after next
> will relieve them of the need to unref the BlockDriverState.
> 
> Complication: due to the silly way drive_del works, we need a way to
> hide a BlockBackend, just like bdrv_make_anon().  To emphasize its
> "special" status, give the function a suitably off-putting name:
> blk_hide_on_behalf_of_do_drive_del().  Unfortunately, hiding turns the
> BlockBackend's name into the empty string.  Can't avoid that without
> breaking the blk->bs->device_name equals blk->name invariant.
> 
> The patch adds a memory leak: drive_del while a device model is
> connected leaks the BlockBackend.  Avoiding the leak here is rather
> hairy, but it'll become straightforward shortly, so I mark it FIXME in
> the code now, and plug it when it's easy.

Does this leak actually still exist now that you have a blk_unref() in
drive_del() (which is called during autodel) rather than do_drive_del()?

> Signed-off-by: Markus Armbruster <[email protected]>
> Reviewed-by: Max Reitz <[email protected]>

Kevin

Reply via email to