From 2576565df6c73dbe15aec05f72ba71231e61b9f7 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Mon, 23 Nov 2020 14:30:58 +0100 Subject: [PATCH] cups-browsed.c: Free the allocated memory if error happened and we have a cluster The code previously leaked several structs, if an error occured during print cluster creation. (cherry picked from commit 4d588e5d29fdb2396b45bec3a7cd2819fca761e0) --- utils/cups-browsed.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/utils/cups-browsed.c b/utils/cups-browsed.c index 43a80f5c6..e136f72e1 100644 --- a/utils/cups-browsed.c +++ b/utils/cups-browsed.c @@ -8963,6 +8963,21 @@ gboolean update_cups_queues(gpointer unused) { p->timeout = current_time + pause_between_cups_queue_updates; cannot_create: + if (printer_attributes != NULL && num_cluster_printers != 1) + ippDelete(printer_attributes); + + if (default_pagesize != NULL && num_cluster_printers != 1) + free(default_pagesize); + + if (conflicts != NULL && num_cluster_printers != 1) + cupsArrayDelete(conflicts); + + if (make_model != NULL && num_cluster_printers != 1) + free(make_model); + + if (sizes != NULL && num_cluster_printers != 1) + cupsArrayDelete(sizes); + if (p && !in_shutdown) remove_printer_entry(p); -- 2.47.3