]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
scheduler/job.c: unload job before freeing job history in cupsdDeleteJob() 813/head
authorBryan Mason <bmason@redhat.com>
Fri, 27 Oct 2023 18:37:02 +0000 (11:37 -0700)
committerBryan Mason <bmason@redhat.com>
Fri, 27 Oct 2023 18:37:02 +0000 (11:37 -0700)
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

index ba98bf1f058a636fc700c4158a39f2b688184b81..36474ea74a7a34f454aca558e034d53737cde95e 100644 (file)
@@ -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);