[gnome-control-center] printers: Fix leak of printer name in callbacks.
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] printers: Fix leak of printer name in callbacks.
- Date: Thu, 29 Oct 2020 23:13:58 +0000 (UTC)
commit 509beee6dcb8b822c7a091939ec1a6ccdd1f7669
Author: Robert Ancell <robert ancell canonical com>
Date: Fri Oct 30 10:16:11 2020 +1300
printers: Fix leak of printer name in callbacks.
printer_set_ppd_async and printer_set_ppd_file_async copy the printer name, but
this isn't freed in any cases that use these callback (the string isn't even
used at all).
panels/printers/pp-details-dialog.c | 4 ++--
panels/printers/pp-utils.c | 8 ++++----
panels/printers/pp-utils.h | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/panels/printers/pp-details-dialog.c b/panels/printers/pp-details-dialog.c
index 98ca1d409..8882a0f49 100644
--- a/panels/printers/pp-details-dialog.c
+++ b/panels/printers/pp-details-dialog.c
@@ -94,7 +94,7 @@ ppd_names_free (gpointer user_data)
}
}
-static void set_ppd_cb (gchar *printer_name, gboolean success, gpointer user_data);
+static void set_ppd_cb (const gchar *printer_name, gboolean success, gpointer user_data);
static void
get_ppd_names_cb (PPDName **names,
@@ -139,7 +139,7 @@ search_for_drivers (PpDetailsDialog *self)
}
static void
-set_ppd_cb (gchar *printer_name,
+set_ppd_cb (const gchar *printer_name,
gboolean success,
gpointer user_data)
{
diff --git a/panels/printers/pp-utils.c b/panels/printers/pp-utils.c
index f496fa7fb..ca849bc2b 100644
--- a/panels/printers/pp-utils.c
+++ b/panels/printers/pp-utils.c
@@ -1443,7 +1443,7 @@ printer_set_ppd_async_dbus_cb (GObject *source_object,
/* Don't call callback if cancelled */
if (!data->cancellable ||
!g_cancellable_is_cancelled (data->cancellable))
- data->callback (g_strdup (data->printer_name),
+ data->callback (data->printer_name,
result,
data->user_data);
@@ -1515,7 +1515,7 @@ printer_set_ppd_async (const gchar *printer_name,
return;
out:
- callback (g_strdup (printer_name), FALSE, user_data);
+ callback (printer_name, FALSE, user_data);
g_clear_object (&data->cancellable);
g_free (data->printer_name);
@@ -1570,7 +1570,7 @@ printer_set_ppd_file_async_scb (GObject *source_object,
return;
out:
- data->callback (g_strdup (data->printer_name), FALSE, data->user_data);
+ data->callback (data->printer_name, FALSE, data->user_data);
g_clear_object (&data->cancellable);
g_free (data->printer_name);
@@ -1628,7 +1628,7 @@ printer_set_ppd_file_async (const gchar *printer_name,
return;
out:
- callback (g_strdup (printer_name), FALSE, user_data);
+ callback (printer_name, FALSE, user_data);
g_clear_object (&data->cancellable);
g_free (data->printer_name);
diff --git a/panels/printers/pp-utils.h b/panels/printers/pp-utils.h
index 211fff52d..34762ff33 100644
--- a/panels/printers/pp-utils.h
+++ b/panels/printers/pp-utils.h
@@ -133,7 +133,7 @@ gchar *printer_get_hostname (cups_ptype_t printer_type,
const gchar *device_uri,
const gchar *printer_uri);
-typedef void (*PSPCallback) (gchar *printer_name,
+typedef void (*PSPCallback) (const gchar *printer_name,
gboolean success,
gpointer user_data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]