nandfs_meta_bread() calls bread() which can set bp to NULL in some

error cases. Calling brelse() with a NULL pointer is not allowed,
so only call brelse() when the bp is non-NULL.

Reported by: Maxime Villard (reported as uninitialized variable)
This commit is contained in:
imp 2015-03-01 21:41:37 +00:00
parent 9baadf23b3
commit 58c9460670

View File

@ -317,7 +317,8 @@ bmap_truncate_indirect(struct nandfs_node *node, int level, nandfs_lbn_t *left,
error = nandfs_bread_meta(node, lbn, NOCRED, 0, &bp);
if (error) {
brelse(bp);
if (bp != NULL)
brelse(bp);
return (error);
}