From dd9e489c05b1caaec71746d3ce0fe2ec8f32555e Mon Sep 17 00:00:00 2001 From: tegge Date: Mon, 15 May 2006 22:59:23 +0000 Subject: Don't leak a locked buffer if last block on file system cannot be read. --- sys/ufs/ffs/ffs_snapshot.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sys') 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 -- cgit v1.1