Commit 34c6f05032edb8c095426e0308b4a131a9265b44
1 parent
66a3cc79
unlink the bs from bdrv-list upon bdrv_delete(bs)
(Uri Lublin) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4179 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
8 additions
and
1 deletions
block.c
... | ... | @@ -452,7 +452,14 @@ void bdrv_close(BlockDriverState *bs) |
452 | 452 | |
453 | 453 | void bdrv_delete(BlockDriverState *bs) |
454 | 454 | { |
455 | - /* XXX: remove the driver list */ | |
455 | + BlockDriverState **pbs; | |
456 | + | |
457 | + pbs = &bdrv_first; | |
458 | + while (*pbs != bs && *pbs != NULL) | |
459 | + pbs = &(*pbs)->next; | |
460 | + if (*pbs == bs) | |
461 | + *pbs = bs->next; | |
462 | + | |
456 | 463 | bdrv_close(bs); |
457 | 464 | qemu_free(bs); |
458 | 465 | } | ... | ... |