From 2a8b98111311cd7d4fe44b4ad9d99f92a41a67da Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Mon, 11 Oct 2021 10:18:07 +0200 Subject: [PATCH] fix issues reported by Coverity scan --- scp-covscan.patch | 93 ++++++++++++++++++++++++++++++++++++++ system-config-printer.spec | 6 ++- 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 scp-covscan.patch diff --git a/scp-covscan.patch b/scp-covscan.patch new file mode 100644 index 0000000..e2bc777 --- /dev/null +++ b/scp-covscan.patch @@ -0,0 +1,93 @@ +diff --git a/scp-dbus-service.py b/scp-dbus-service.py +index fcccf89..b623014 100644 +--- a/scp-dbus-service.py ++++ b/scp-dbus-service.py +@@ -380,7 +380,7 @@ class ConfigPrintingNewPrinterDialog(dbus.service.Object): + def on_printer_modified(self, obj, name, ppd_has_changed): + debugprint ("%s: printer modified" % self) + g_killtimer.remove_hold () +- self.PrinterModifed (name, ppd_has_changed) ++ self.PrinterModified (name, ppd_has_changed) + self.remove_handles () + self.remove_from_connection () + +diff --git a/udev/udev-configure-printer.c b/udev/udev-configure-printer.c +index 5d7c25e..fd158b0 100644 +--- a/udev/udev-configure-printer.c ++++ b/udev/udev-configure-printer.c +@@ -205,6 +205,12 @@ add_device_uri (struct device_uris *uris, + uris->n_uris = 1; + uris->uri[0] = uri_copy; + } ++ else ++ { ++ syslog (LOG_ERR, "out of memory"); ++ free (uri_copy); ++ return; ++ } + } + else + { +@@ -847,6 +853,7 @@ device_id_from_devpath (struct udev *udev, const char *devpath, + + udev_device_unref (dev); + free (devicefilepath); ++ g_free(device_id); + return usb_device_devpath; + } + +@@ -1274,7 +1281,6 @@ find_matching_device_uris (struct device_id *id, + { + add_usb_uri_mapping (&map, devpath, uris); + write_usb_uri_map (map); +- free_usb_uri_map (map); + } + + return uris->n_uris; +@@ -1527,6 +1533,11 @@ skip: + free(this_device_uri_n); + this_device_uri_n = NULL; + } ++ if (device_uri_n != NULL) ++ { ++ free(device_uri_n); ++ device_uri_n = NULL; ++ } + if (!attr) + break; + } +@@ -1625,6 +1636,7 @@ do_add (const char *cmd, const char *devaddr) + if (udev == NULL) + { + syslog (LOG_ERR, "udev_new failed"); ++ free_usb_uri_map (map); + exit (1); + } + +@@ -1643,7 +1655,7 @@ do_add (const char *cmd, const char *devaddr) + if (!id.mfg || !id.mdl) + { + clear_device_id (&id); +- free (map); ++ free_usb_uri_map (map); + free (usb_device_devpath); + return 1; + } +@@ -1668,7 +1680,7 @@ do_add (const char *cmd, const char *devaddr) + { + syslog (LOG_ERR, "no corresponding CUPS device found"); + clear_device_id (&id); +- free (map); ++ free_usb_uri_map (map); + return 0; + } + +@@ -1722,7 +1734,7 @@ do_add (const char *cmd, const char *devaddr) + + clear_device_id (&id); + free_device_uris (&device_uris); +- free (map); ++ free_usb_uri_map (map); + return 0; + } + diff --git a/system-config-printer.spec b/system-config-printer.spec index 988cb88..0c4e640 100644 --- a/system-config-printer.spec +++ b/system-config-printer.spec @@ -9,12 +9,13 @@ Summary: A printer administration tool Name: system-config-printer Version: 1.5.15 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2+ URL: https://github.com/%{username}/%{name} Source0: %{url}/releases/download/%{version}/%{name}-%{version}.tar.xz # all upstream patches, remove with new release +Patch01: scp-covscan.patch # gcc is no longer in buildroot by default @@ -253,6 +254,9 @@ exit 0 %endif %changelog +* Mon Sep 06 2021 Zdenek Dohnal - 1.5.15-5 +- fix issues reported by Coverity scan + * Fri Jul 23 2021 Fedora Release Engineering - 1.5.15-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild