minor cleanup
nuke another malloc, use string as an RAII wrapper