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:
Chih-Wei Huang 2014-04-15 16:23:07 +08:00 committed by Erik Larsson
parent 419d3399dc
commit a0914beb98

View File

@ -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