fs/squashfs: avoid illegal free() in sqfs_opendir()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 14 Apr 2025 13:19:24 +0000 (15:19 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 21 Apr 2025 17:08:03 +0000 (11:08 -0600)
commit185fdf5e94731df05748b1c576effb52ff7a3ec5
tree5c1a5e065022bf4be00203c65760de3d7254e276
parent3e6bbc5adc20242a5056cfa142782debc0c368b5
fs/squashfs: avoid illegal free() in sqfs_opendir()

* Use calloc() to allocate token_list. This avoids an illegal free if
  sqfs_tokenize() fails.
* Do not iterate over token_list if it has not been allocated.

Addresses-Coverity-ID: 510453:  Null pointer dereferences  (FORWARD_NULL)
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
fs/squashfs/sqfs.c