mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-11-23 18:14:24 +08:00
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.
This commit is contained in:
parent
419d3399dc
commit
a0914beb98
@ -524,8 +524,11 @@ static int ntfs_fuse_parse_path(const char *org_path, char **path,
|
||||
if (stream_name_mbs) {
|
||||
*stream_name = NULL;
|
||||
res = ntfs_mbstoucs(stream_name_mbs, stream_name);
|
||||
if (res < 0)
|
||||
if (res < 0) {
|
||||
free(*path);
|
||||
*path = NULL;
|
||||
return -errno;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
} else
|
||||
|
Loading…
Reference in New Issue
Block a user