summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1996-01-04 06:09:00 +0000
committerdg <dg@FreeBSD.org>1996-01-04 06:09:00 +0000
commitcbf2802c78bc93c8a31a1079e7c8e78b0a837b6a (patch)
tree6b68ab0b991287245dcc154f41bf5699fc880b37
parent1f3fc3286fc9f1c12d825938823cc46f9b34bc61 (diff)
downloadFreeBSD-src-cbf2802c78bc93c8a31a1079e7c8e78b0a837b6a.zip
FreeBSD-src-cbf2802c78bc93c8a31a1079e7c8e78b0a837b6a.tar.gz
Fixed minor struct cred leak. Discovered while looking for the opposite
condition - too many frees, which has yet to be found. Reviewed by: dyson
-rw-r--r--sys/kern/vfs_bio.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 9abc346..6610a32 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -18,7 +18,7 @@
* 5. Modifications may be freely made to this file if the above conditions
* are met.
*
- * $Id: vfs_bio.c,v 1.78 1995/12/13 03:47:01 dyson Exp $
+ * $Id: vfs_bio.c,v 1.79 1995/12/14 08:32:09 phk Exp $
*/
/*
@@ -722,12 +722,16 @@ trytofreespace:
if (bp->b_vp)
brelvp(bp);
+fillbuf:
/* we are not free, nor do we contain interesting data */
- if (bp->b_rcred != NOCRED)
+ if (bp->b_rcred != NOCRED) {
crfree(bp->b_rcred);
- if (bp->b_wcred != NOCRED)
+ bp->b_rcred = NOCRED;
+ }
+ if (bp->b_wcred != NOCRED) {
crfree(bp->b_wcred);
-fillbuf:
+ bp->b_wcred = NOCRED;
+ }
bp->b_flags |= B_BUSY;
LIST_REMOVE(bp, b_hash);
LIST_INSERT_HEAD(&invalhash, bp, b_hash);
@@ -744,7 +748,6 @@ fillbuf:
bp->b_resid = 0;
bp->b_bcount = 0;
bp->b_npages = 0;
- bp->b_wcred = bp->b_rcred = NOCRED;
bp->b_data = buffers_kva + (bp - buf) * MAXBSIZE;
bp->b_dirtyoff = bp->b_dirtyend = 0;
bp->b_validoff = bp->b_validend = 0;
OpenPOWER on IntegriCloud