qemu-io: delete bs instead of leaking it
PATCH 1/1 qemu-io: delete bs instead of leaking it
Using bdrv_close() is not enough to free a BlockDriverState. Since we explicitly create it with bdrv_new(), use bdrv_delete() to close and delete it.
Signed-off-by Stefan Hajnoczi <[email protected]>
--- qemu-io.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
qemu-io.c +2 -1
@@ -1581,7 +1581,7 @@ static const cmdinfo_t map_cmd = {static int close_f (int argc,char **argv) { -bdrv_close (bs); +bdrv_delete (bs); bs =NULL ;return 0 ; }
@@ -1610,6 +1610,7 @@ static int openfile(char *name, int flags, int growable)if (bdrv_open (bs, name, flags,NULL ) <0 ) {fprintf (stderr,"%s: can't open device %s\n" , progname, name); +bdrv_delete (bs); bs =NULL ;return 1 ; }
Signature · 1 line
1.7.7
Am 27.10.2011 09:42, schrieb Stefan Hajnoczi:
Quoted 5 lines
Using
bdrv_close()is not enough to free a BlockDriverState. Since we explicitly create it withbdrv_new(), usebdrv_delete()to close and delete it.Signed-off-by Stefan Hajnoczi <[email protected]>
At the end of main() there's another bdrv_close() call that should be changed.
Kevin