ntfs: Fix PVS V595
Check pointers against NULL befor using them. Change-Id: I84fc7d60179fff46f78302e212bbcf7e5105126b Reviewed-on: https://review.haiku-os.org/c/haiku/+/2223 Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
committed by
Jérôme Duval
parent
ffd6c2f4bd
commit
b8476a30d7
@@ -64,17 +64,22 @@ static uint8 ntfs_count_bits(unsigned char byte, unsigned char shift)
|
|||||||
int ntfs_calc_free_space(nspace *_ns)
|
int ntfs_calc_free_space(nspace *_ns)
|
||||||
{
|
{
|
||||||
nspace *ns = (nspace*)_ns;
|
nspace *ns = (nspace*)_ns;
|
||||||
ntfs_volume *vol = ns->ntvol;
|
ntfs_volume *vol;
|
||||||
ntfs_attr *data = vol->lcnbmp_na;
|
ntfs_attr *data;
|
||||||
s64 free_clusters = 0;
|
s64 free_clusters = 0;
|
||||||
off_t pos = 0;
|
off_t pos = 0;
|
||||||
size_t readed;
|
size_t readed;
|
||||||
unsigned char *buf = NULL;
|
unsigned char *buf;
|
||||||
|
|
||||||
if (ns == NULL || vol == NULL || data == NULL)
|
if (ns == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (vol->lcnbmp_na == NULL)
|
vol = ns->ntvol;
|
||||||
|
if (vol == NULL)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
data = vol->lcnbmp_na;
|
||||||
|
if (data == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!(ns->state & NF_FreeClustersOutdate))
|
if (!(ns->state & NF_FreeClustersOutdate))
|
||||||
|
|||||||
Reference in New Issue
Block a user