namjaejeon / exfatprogs

exFAT filesystem userspace utilities
https://github.com/exfatprogs/exfatprogs
GNU General Public License v2.0
33 stars 66 forks source link

fsck:fix double free of exfat pointer #56

Closed yijiangqiu1 closed 2 years ago

yijiangqiu1 commented 2 years ago

in function init_exfat(exfat,bs),if it fails to calloc memory,it will call function free_exfat and return -ENOMEM. Thus it will goto err in main function and call free_exfat(exfat) again. As follows: main ->init_exfat(exfat,bs) ->free_exfat(exfat) return -ENOMEM ->free_exfat(exfat) Let exfat = NULL if we failed to init exfat.

Signed-off-by: yijiangqiu1 wangfangli@xiaomi.com