]> 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:49:14 +0000 (10:49 +0100)
committerZdenek Dohnal <zdohnal@redhat.com>
Mon, 30 Oct 2023 09:49:14 +0000 (10:49 +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 2daa4a86bb09eb22d89c45bb8ed66591eb9b2d4f..f7dba2fac942fef0799d525a32168439f0326d23 100644 (file)
@@ -4,6 +4,7 @@ CHANGES - OpenPrinting CUPS 2.4.8 - TBA
 Changes in CUPS v2.4.8 (TBA)
 ----------------------------
 
+- Fixed memory leak when creating color profiles
 - Raised `cups_enum_dests()` timeout for listing available IPP printers (Issue #751)
 - Really backport fix for Issue #742
 
index 809ed7c65ddfc1a3f85977f359d4dd681c89aa09..9071271f0b7649fc38efd8a2d18ad462c8c6f6fb 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: