vsnprintf: use stack buffer

this also fixes a leak in usage of realloc. when realloc fails, original buffer was not freed.