free(NULL) is legal according to the C spec
Use calloc instead of malloc and assignment
Don't use C++ style comments
Don't mix decl
Fix buffer overrun