Fixed memory leak in userlog_read()
This commit is contained in:
parent
3464cb38b8
commit
cc496b2fbd
1 changed files with 6 additions and 1 deletions
|
@ -162,7 +162,12 @@ namespace pvpgn
|
|||
if (!username)
|
||||
throw std::runtime_error("username is a nullptr");
|
||||
|
||||
FILE* fp = std::fopen(userlog_filename(username), "r");
|
||||
FILE* fp = nullptr;
|
||||
{
|
||||
const char* const filename = userlog_filename(username);
|
||||
fp = std::fopen(filename, "r");
|
||||
xfree((void*)filename);
|
||||
}
|
||||
if (!fp)
|
||||
throw std::runtime_error("Could not open userlog");
|
||||
|
||||
|
|
Loading…
Reference in a new issue