Fix malloc/string bug in client