diff options
| -rw-r--r-- | kernel/fs.c | 4 | 
1 files changed, 3 insertions, 1 deletions
| diff --git a/kernel/fs.c b/kernel/fs.c index da9bcca..5505408 100644 --- a/kernel/fs.c +++ b/kernel/fs.c @@ -470,8 +470,10 @@ readi(struct inode *ip, int user_dst, uint64 dst, uint off, uint n)    for(tot=0; tot<n; tot+=m, off+=m, dst+=m){      bp = bread(ip->dev, bmap(ip, off/BSIZE));      m = min(n - tot, BSIZE - off%BSIZE); -    if(either_copyout(user_dst, dst, bp->data + (off % BSIZE), m) == -1) +    if(either_copyout(user_dst, dst, bp->data + (off % BSIZE), m) == -1) { +      brelse(bp);        break; +    }      brelse(bp);    }    return n; | 
