Remove bio leak when EIO error is emulated.

Found by:	Coverity Prevent(tm)
MFC after:	3 days
This commit is contained in:
Pawel Jakub Dawidek 2006-01-17 07:22:44 +00:00
parent e0078c6436
commit 54df0743c7

View File

@ -81,11 +81,6 @@ g_nop_start(struct bio *bp)
gp = bp->bio_to->geom;
sc = gp->softc;
G_NOP_LOGREQ(bp, "Request received.");
cbp = g_clone_bio(bp);
if (cbp == NULL) {
g_io_deliver(bp, ENOMEM);
return;
}
switch (bp->bio_cmd) {
case BIO_READ:
sc->sc_reads++;
@ -105,6 +100,11 @@ g_nop_start(struct bio *bp)
return;
}
}
cbp = g_clone_bio(bp);
if (cbp == NULL) {
g_io_deliver(bp, ENOMEM);
return;
}
cbp->bio_done = g_std_done;
cbp->bio_offset = bp->bio_offset + sc->sc_offset;
cbp->bio_data = bp->bio_data;