This is not necessarily a problem, other than a small security issue: The previous contents of memory, which may hold sensitive information, will get written to the file.
You can memset the structure to 0 before filling its fields to avoid this error.