Avoid keeping pointer to temporary strings (#4016)
Avoid keeping pointer to temporary strings (#4016)

BUG
substr() creates a temporary string which will be deallocated, leaving the c_str() pointer pointing to garbage.

Co-authored-by: Ping Yu <e3982a96662cc73e971d68f6aafe25f9d2e93e85@users.noreply.github.com>
tensorflow/tfjs,tensorflow/tfjs,tensorflow/tfjs,tensorflow/tfjs,tensorflow/tfjs,tensorflow/tfjs,tensorflow/tfjs,tensorflow/tfjs,tensorflow/tfjs