Merge pull request #2014 from matt335672/xrdp_leaks

Fix definitely lost memory leaks #2014
This commit is contained in:
matt335672 2021-10-20 10:23:09 +01:00 committed by GitHub
commit 0c605a3cc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View File

@ -667,6 +667,13 @@ log_config_free(struct log_config *config)
list_delete(config->per_logger_level);
config->per_logger_level = NULL;
}
if (0 != config->log_file)
{
g_free(config->log_file);
config->log_file = 0;
}
g_free(config);
}

View File

@ -1006,6 +1006,8 @@ find_matching_extended_rect(struct vnc *v,
}
}
free_stream(s);
return error;
}

View File

@ -572,6 +572,7 @@ main(int argc, char **argv)
{
g_writeln("It looks like xrdp is already running.");
g_writeln("If not, delete %s and try again.", pid_file);
log_end();
g_deinit();
g_exit(0);
}
@ -591,6 +592,7 @@ main(int argc, char **argv)
if (fd == -1)
{
g_writeln("running in daemon mode with no access to pid files, quitting");
log_end();
g_deinit();
g_exit(0);
}
@ -598,6 +600,7 @@ main(int argc, char **argv)
if (g_file_write(fd, "0", 1) == -1)
{
g_writeln("running in daemon mode with no access to pid files, quitting");
log_end();
g_deinit();
g_exit(0);
}
@ -613,6 +616,7 @@ main(int argc, char **argv)
{
LOG(LOG_LEVEL_ERROR, "Failed to start xrdp daemon, "
"possibly address already in use.");
log_end();
g_deinit();
/* must exit with failure status,
or systemd cannot detect xrdp daemon couldn't start properly */
@ -624,6 +628,7 @@ main(int argc, char **argv)
if (pid == -1)
{
g_writeln("problem forking");
log_end();
g_deinit();
g_exit(1);
}
@ -632,6 +637,7 @@ main(int argc, char **argv)
{
g_writeln("daemon process %d started ok", pid);
/* exit, this is the main process */
log_end();
g_deinit();
g_exit(0);
}