Fix a possible memory leak
In ntfs_fuse_parse_path(), it's possible that strdup() succeeds but ntfs_mbstoucs() returns a negative value. In such a case the callers just treat it as an error and ignores the allocated path buffer that results in a memory leak.edge.strict_endians
parent
419d3399dc
commit
a0914beb98
|
@ -524,8 +524,11 @@ static int ntfs_fuse_parse_path(const char *org_path, char **path,
|
||||||
if (stream_name_mbs) {
|
if (stream_name_mbs) {
|
||||||
*stream_name = NULL;
|
*stream_name = NULL;
|
||||||
res = ntfs_mbstoucs(stream_name_mbs, stream_name);
|
res = ntfs_mbstoucs(stream_name_mbs, stream_name);
|
||||||
if (res < 0)
|
if (res < 0) {
|
||||||
|
free(*path);
|
||||||
|
*path = NULL;
|
||||||
return -errno;
|
return -errno;
|
||||||
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in New Issue