> From security-discuss-bounces at opensolaris.org Tue Feb 24 12:46:59 2009 > * As Gary already said, it's better to use strdup() in get_username() > instead of reimplementing it yourself. In fact, you can just return > uspw->pw_name (without copying the string) as long as you don't try to > keep using the old value after the next time you call get_username().
struct passwd uspw also needs to be global, not an automatic in the function. > Don't forget to remove the free() at line 231. And likely other free's -- of course. Gary..