summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortegge <tegge@FreeBSD.org>2006-05-15 22:59:23 +0000
committertegge <tegge@FreeBSD.org>2006-05-15 22:59:23 +0000
commitdd9e489c05b1caaec71746d3ce0fe2ec8f32555e (patch)
treebec0550152b3742ff4ede7f975ccfc8ec589bacf
parente757e51d552221d5d5660b6939ee4190d1ab6d65 (diff)
downloadFreeBSD-src-dd9e489c05b1caaec71746d3ce0fe2ec8f32555e.zip
FreeBSD-src-dd9e489c05b1caaec71746d3ce0fe2ec8f32555e.tar.gz
Don't leak a locked buffer if last block on file system cannot be read.
-rw-r--r--sys/ufs/ffs/ffs_snapshot.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c
index 2b5bf1c..0c011ea 100644
--- a/sys/ufs/ffs/ffs_snapshot.c
+++ b/sys/ufs/ffs/ffs_snapshot.c
@@ -292,9 +292,10 @@ restart:
ip->i_size = lblktosize(fs, (off_t)numblks);
DIP_SET(ip, i_size, ip->i_size);
ip->i_flag |= IN_CHANGE | IN_UPDATE;
- if ((error = readblock(vp, bp, numblks - 1)) != 0)
- goto out;
+ error = readblock(vp, bp, numblks - 1);
bawrite(bp);
+ if (error != 0)
+ goto out;
/*
* Preallocate critical data structures so that we can copy
* them in without further allocation after we suspend all
OpenPOWER on IntegriCloud