From: Zdenek Dohnal Date: Mon, 30 Oct 2023 09:21:47 +0000 (+0100) Subject: scheduler/colorman.c: Fix memory leak during creating color profile X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6dcf52cf1a27769ff1d9de32ac788d6a0118afff;p=thirdparty%2Fcups.git scheduler/colorman.c: Fix memory leak during creating color profile 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 . --- diff --git a/CHANGES.md b/CHANGES.md index faa638f5cd..9f40618fbe 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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) diff --git a/scheduler/colorman.c b/scheduler/colorman.c index 60293df220..cbdd717209 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: