plougher / squashfs-tools

tools to create and extract Squashfs filesystems
GNU General Public License v2.0
764 stars 195 forks source link

Removed potential double-free #271

Closed 47Cid closed 10 months ago

plougher commented 10 months ago

get_comp() will always return NULL or a new string, and so a double free won't happen, and a free() of a NULL pointer is OK. But, it is a bit pointless to always unconditionally free(comp) and then check whether it is not NULL immediately afterwards.

BTW you have forgotten to add brackets, as there are now more than one statement in the if. I'll fix it after applying it.