Skip to content

Commit e22b2d7

Browse files
Andrea della Portatrini
Andrea della Porta
authored andcommitted
fs/squashfs: Fix memory leak in sqfs_size_nest()
In case MAX_SYMLINK_NEST is reached while determining the size on a symlink node, the function returns immediately. This would not free the resources after the free_strings: label causing a memory leak. Set the ret value and just break out of the switch to fix this. Signed-off-by: Andrea della Porta <[email protected]> Reviewed-by: Miquel Raynal <[email protected]>
1 parent 31378bd commit e22b2d7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/squashfs/sqfs.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,8 @@ static int sqfs_size_nest(const char *filename, loff_t *size)
17121712
case SQFS_LSYMLINK_TYPE:
17131713
if (++symlinknest == MAX_SYMLINK_NEST) {
17141714
*size = 0;
1715-
return -ELOOP;
1715+
ret = -ELOOP;
1716+
break;
17161717
}
17171718

17181719
symlink = (struct squashfs_symlink_inode *)ipos;

0 commit comments

Comments
 (0)