DragonFlyBSD Kernel Audit
DF-0828 / fix.diff
← back to finding ↓ download raw
diff --git a/vfs/msdosfs/msdosfs_fat.c b/vfs/msdosfs/msdosfs_fat.c
--- a/vfs/msdosfs/msdosfs_fat.c
+++ b/vfs/msdosfs/msdosfs_fat.c
@@ -1152,8 +1152,11 @@
 	byteoffset = FATOFS(pmp, 1);
 	fatblock(pmp, byteoffset, &bn, &bsize, &bo);
 	error = bread(pmp->pm_devvp, de_bn2doff(pmp, bn), bsize, &bp);
-	if (error)
+	if (error) {
+		if (bp)
+			brelse(bp);
 		return (error);
+	}
 
 	/*
 	 * Get the current value of the FAT entry and set/clear the relevant