Skip to content

Commit

Permalink
scheduler/job.c: unload job before freeing job history in cupsdDelete…
Browse files Browse the repository at this point in the history
…job()



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.

The solution seems to be to unload the job before freeing the job history.
  • Loading branch information
zdohnal authored Oct 30, 2023
2 parents 082c5ae + 7781cc7 commit e6fcc26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scheduler/job.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e6fcc26

Please sign in to comment.