James Carlson wrote: > Darren Reed writes: >> As part of this continuing code review, I looked at >> http://cr.opensolaris.org/~tonyn/firewall13Jan2009/usr/src/cmd/svc/servinfo/servinfo.c >> >> and I'm wondering if you have, in your latest workspace, a version >> of uaddr2port() that doesn't leak memory from the malloc() for port_str? >> The other alternative is to use alloca() instead. > > I doubt that either malloc or alloca is needed here. strtol should be > able to crack those numbers without having to make a separate copy. >
Darren and James, I'll use strtol() to simplify the code. Thank you both for the suggestions, -tony