fix memory leaks when unloading job

This commit is contained in:
Zdenek Dohnal 2023-11-03 08:16:18 +01:00
parent abbee104ee
commit d38fff00a0
3 changed files with 43 additions and 1 deletions

13
cups-colorman-leak.patch Normal file
View File

@ -0,0 +1,13 @@
diff --git a/scheduler/colorman.c b/scheduler/colorman.c
index 809ed7c..9071271 100644
--- a/scheduler/colorman.c
+++ b/scheduler/colorman.c
@@ -1080,7 +1080,7 @@ colord_create_profile(
dbus_message_iter_get_basic(&args, &profile_path);
cupsdLogMessage(CUPSD_LOG_DEBUG, "Created profile \"%s\".", profile_path);
- cupsArrayAdd(profiles, strdup(profile_path));
+ cupsArrayAdd(profiles, profile_path);
out:

View File

@ -0,0 +1,18 @@
diff --git a/scheduler/job.c b/scheduler/job.c
index 32f2519..6425305 100644
--- a/scheduler/job.c
+++ b/scheduler/job.c
@@ -1500,11 +1500,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);

View File

@ -22,7 +22,7 @@ Summary: CUPS printing system
Name: cups
Epoch: 1
Version: 2.4.7
Release: 1%{?dist}
Release: 2%{?dist}
# backend/failover.c - BSD-3-Clause
# cups/md5* - Zlib
# scheduler/colorman.c - Apache-2.0 WITH LLVM-exception AND BSD-2-Clause
@ -87,6 +87,10 @@ Patch100: cups-lspp.patch
# https://github.com/OpenPrinting/cups/pull/742
# 2218124 - The command "cancel -x <job>" does not remove job files
Patch1001: 0001-Use-purge-job-instead-of-purge-jobs-when-canceling-a.patch
# https://github.com/OpenPrinting/cups/pull/814
Patch1002: cups-colorman-leak.patch
# https://github.com/OpenPrinting/cups/pull/813/
Patch1003: cups-unload-job-leak.patch
##### Patches removed because IMHO they aren't no longer needed
@ -311,6 +315,10 @@ to CUPS daemon. This solution will substitute printer drivers and raw queues in
# UPSTREAM PATCHES
# 2218124 - The command "cancel -x <job>" does not remove job files
%patch -P 1001 -p1 -b .purge-job
# https://github.com/OpenPrinting/cups/pull/814
%patch -P 1002 -p1 -b .colorman
# https://github.com/OpenPrinting/cups/pull/813/
%patch -P 1003 -p1 -b .unloadjob
%if %{lspp}
@ -783,6 +791,9 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man7/ippeveps.7.gz
%changelog
* Mon Oct 30 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.4.7-2
- fix memory leaks when unloading job
* Wed Sep 20 2023 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.4.7-1
- 2239982 - cups-2.4.7 is available