[gnome-software: 1/3] gs-common: Fix a small leak




commit 5dd2184b8e79f1b94f58195802152df75db97cc1
Author: Philip Withnall <pwithnall endlessos org>
Date:   Thu May 12 13:35:57 2022 +0100

    gs-common: Fix a small leak
    
    `gs_app_get_origin_ui()` returns a newly allocated string.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 src/gs-common.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-common.c b/src/gs-common.c
index af56c4428..2c4fc7789 100644
--- a/src/gs-common.c
+++ b/src/gs-common.c
@@ -232,6 +232,7 @@ gs_app_notify_unavailable (GsApp *app, GtkWindow *parent)
        GtkWidget *dialog;
        const gchar *license;
        gboolean already_enabled = FALSE;       /* FIXME */
+       g_autofree gchar *origin_ui = NULL;
        guint i;
        struct {
                const gchar     *str;
@@ -286,6 +287,8 @@ gs_app_notify_unavailable (GsApp *app, GtkWindow *parent)
        gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), title->str);
 
        body = g_string_new ("");
+       origin_ui = gs_app_get_origin_ui (app);
+
        if (hint & GS_APP_LICENSE_NONFREE) {
                g_string_append_printf (body,
                                        /* TRANSLATORS: the replacements are as follows:
@@ -296,7 +299,7 @@ gs_app_notify_unavailable (GsApp *app, GtkWindow *parent)
                                          "free and open source software</a>, "
                                          "and is provided by ā€œ%sā€."),
                                        gs_app_get_name (app),
-                                       gs_app_get_origin_ui (app));
+                                       origin_ui);
        } else {
                g_string_append_printf (body,
                                        /* TRANSLATORS: the replacements are as follows:
@@ -304,7 +307,7 @@ gs_app_notify_unavailable (GsApp *app, GtkWindow *parent)
                                         * 2. Software repository name, e.g. fedora-optional */
                                        _("%s is provided by ā€œ%sā€."),
                                        gs_app_get_name (app),
-                                       gs_app_get_origin_ui (app));
+                                       origin_ui);
        }
 
        /* tell the use what needs to be done */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]