Fix memory leak in _handle_tos_command() when returning without calling xfree() on variable 'filename'
This commit is contained in:
parent
e0cd3f7894
commit
13ac03d753
1 changed files with 4 additions and 3 deletions
|
@ -4695,11 +4695,9 @@ namespace pvpgn
|
|||
{
|
||||
/* handle /tos - shows terms of service by user request -raistlinthewiz */
|
||||
|
||||
const char * filename = NULL;
|
||||
const char* const filename = i18n_filename(prefs_get_tosfile(), conn_get_gamelang_localized(c));
|
||||
std::FILE * fp;
|
||||
|
||||
filename = i18n_filename(prefs_get_tosfile(), conn_get_gamelang_localized(c));
|
||||
|
||||
/* FIXME: if user enters relative path to tos file in config,
|
||||
above routine will fail */
|
||||
|
||||
|
@ -4749,6 +4747,9 @@ namespace pvpgn
|
|||
eventlog(eventlog_level_error, __FUNCTION__, "could not open tos file \"{}\" for reading (std::fopen: {})", filename, std::strerror(errno));
|
||||
message_send_text(c, message_type_error, c, localize(c, "Unable to send TOS (Terms of Service)."));
|
||||
}
|
||||
|
||||
xfree((void*)filename);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue