Print

Print


Hi Gregory,

Quite correct. It's just sloppy programming on my part because it's a
potential one time memory loss should the parameter be specified again
(which it usually is not). Not clear that the extra effort is worth
correcting this or a comment indicating that this is an intended
potential loss would work just as well. Anyway, I'll look at it more
closely. As for the const changes, I'm still trying to figure out the best
way to get the changes from you. I'm at CERN right now in the middle of
some workshops so I'm constantly being distracted. Not to worry, I won't
drop this (just a small postponement). BTW what's you solution to the
dilema:

char *myroutine() {return (char *)"xyz";}

char *myvar = myroutine();

vs

const char *myroutine() {return "xyz";}

char *myvar = (char *)myroutine();

Since myvar cannot be declared const you wind up with a cast somewhere.

Andy

On Tue, 5 Apr 2005, Gregory J. Sharp wrote:

> There appears to be a memory leak in Xrd/XrdConfig.cc. It probably does
> not account for significant lost memory, but memory leaks are bad form,
> so I will point it out anyway.
>
> XrdConfig::xprotparms returns a string that is either malloced (using
> strdup) or a constant string (""). The caller does not free the string
> in question (since that could be tricky, but doable). The string does
> not appear to be saved, and so is lost.
>
> --
> Gregory J. Sharp                   email: [log in to unmask]
> Wilson Synchrotron Laboratory      url:
> http://www.lepp.cornell.edu/~gregor
> Dryden Rd                          ph:  +1 607 255 4882
> Ithaca, NY 14853                   fax: +1 607 255 8062
>
>