Skip to content

Commit

Permalink
Merge pull request #6846: FileStore: potential memory leak if getattr…
Browse files Browse the repository at this point in the history
…s fails.

Reviewed-by: Loic Dachary <ldachary@redhat.com>
  • Loading branch information
Loic Dachary committed Feb 8, 2016
2 parents 7d5d2a0 + 5d1e6ae commit dc2ae8f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/os/FileStore.cc
Expand Up @@ -3922,6 +3922,7 @@ int FileStore::_fgetattrs(int fd, map<string,bufferptr>& aset)
dout(10) << " -ERANGE, got " << len << dendl;
if (len < 0) {
assert(!m_filestore_fail_eio || len != -EIO);
delete[] names2;
return len;
}
name = names2;
Expand All @@ -3940,8 +3941,10 @@ int FileStore::_fgetattrs(int fd, map<string,bufferptr>& aset)
if (*name) {
dout(20) << "fgetattrs " << fd << " getting '" << name << "'" << dendl;
int r = _fgetattr(fd, attrname, aset[name]);
if (r < 0)
if (r < 0) {
delete[] names2;
return r;
}
}
}
name += strlen(name) + 1;
Expand Down

0 comments on commit dc2ae8f

Please sign in to comment.