- Using snprintf instead of snprintf
- Just one "return"
- Fixed a memory leak