]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
scheduler/colorman.c: Fix memory leak during creating color profile
authorZdenek Dohnal <zdohnal@redhat.com>
Mon, 30 Oct 2023 09:21:47 +0000 (10:21 +0100)
committerZdenek Dohnal <zdohnal@redhat.com>
Mon, 30 Oct 2023 09:21:47 +0000 (10:21 +0100)
Since the array `profiles` is set to use `strdup()` as a copy function, we
don't have to use `strdup()` on the element which is passed as parameter
of `cupsArrayAdd()` - using the `strdup()` as we used till now causes
memory leak.

Reproducer is the same as https://github.com/OpenPrinting/cups/pull/813
.

CHANGES.md
scheduler/colorman.c

index faa638f5cd3c50e2e2a4552995e40769e269ba86..9f40618fbe279b75ec83e27270e8bde62bb9117b 100644 (file)
@@ -16,6 +16,7 @@ Changes in CUPS v2.5b1 (TBA)
 - Fixed extensive looping in scheduler (Issue #604)
 - Fixed hanging of `lpstat` on IBM AIX (Issue #773)
 - Fixed hanging of `lpstat` on Solaris (Issue #156)
+- Fixed memory leak when creating color profiles
 - Fixed segfault in `cupsGetNamedDest()` when trying to get default printer, but
   the default printer is not set (Issue #719)
 - Fixed RFC 1179 port reserving behavior in LPD backend (Issue #743)
index 60293df22015bcd26e8b22371f97055188ae06cf..cbdd71720972ddd345608f5db8e38eff210fd92f 100644 (file)
@@ -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: