Skip to content

Commit

Permalink
Free Entity before replacing it from the cache
Browse files Browse the repository at this point in the history
Toward the beginning of XrdSecProtocolgsi::Authenticate(), memory may be
allocated for the Entity with strdup():
https://github.com/xrootd/xrootd/blob/a76eccc1f2/src/XrdSecgsi/XrdSecProtocolgsi.cc#L1873

Later in the same function, the Entity may be replaced with an entry from the
cache:
https://github.com/xrootd/xrootd/blob/a76eccc1f2/src/XrdSecgsi/XrdSecProtocolgsi.cc#L1951

However, the memory allocated with strdup() is not free()d. Call FreeEntity()
before replacing Entity with a copy.
  • Loading branch information
jthiltges committed Mar 21, 2016
1 parent 422ae9c commit 9fd4616
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/XrdSecgsi/XrdSecProtocolgsi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,7 @@ int XrdSecProtocolgsi::Authenticate(XrdSecCredentials *cred,
} else {
// Fetch a copy of the saved entity
int slen = 0;
FreeEntity(&Entity);
CopyEntity((XrdSecEntity *) cent->buf1.buf, &Entity, &slen);
// Notify
DEBUG("Got Entity from cacheAuthzFun ("<<slen<<" bytes)");
Expand Down

0 comments on commit 9fd4616

Please sign in to comment.