Reading serial data coming from arduino in c++?

Which seems to work now,

You are allocating memory, but not freeing it.

Why not use a static array?

char buf[256];