From 7781cc73cd69cc6c3eba526ac4851d9604e68d43 Mon Sep 17 00:00:00 2001 From: Bryan Mason Date: Fri, 27 Oct 2023 11:37:02 -0700 Subject: [PATCH] scheduler/job.c: unload job before freeing job history in cupsdDeleteJob() With "PreserveJobHistory Off", LogLevel not set to debug (or debug2), and "LogDebugHistory 200" (the default), cupsdDeleteJob() frees the job history and then unloads the job. However, unload_job() calls cupsdLogJob() which re-creates the job history and puts "Unloading..." into it because level (debug) is greater than LogLevel (warn) and LogDebugHistory is set to 200 messages by default. Unused (and unreachable) job history is left behind, resulting in a memory leak. --- scheduler/job.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scheduler/job.c b/scheduler/job.c index ba98bf1f05..36474ea74a 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -1405,11 +1405,11 @@ cupsdDeleteJob(cupsd_job_t *job, /* I - Job */ job->num_files = 0; } + unload_job(job); + if (job->history) free_job_history(job); - unload_job(job); - cupsArrayRemove(Jobs, job); cupsArrayRemove(ActiveJobs, job); cupsArrayRemove(PrintingJobs, job);