From: Bryan Mason Date: Fri, 27 Oct 2023 18:37:02 +0000 (-0700) Subject: scheduler/job.c: unload job before freeing job history in cupsdDeleteJob() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F813%2Fhead;p=thirdparty%2Fcups.git 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. --- 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);