Use project-standard memory management rather than alloca()