[gnome-software/wip/temp/ubuntu-xenial-rebased: 194/329] apt: strdup() the strings about the old version when getting changelogs



commit ded95c7c71807884ab1b01d0ae0f02928e809666
Author: Iain Lane <iain orangesquash org uk>
Date:   Thu Apr 7 11:30:51 2016 +0100

    apt: strdup() the strings about the old version when getting changelogs
    
    When we set the new version then the old ones are freed, so we need to
    keep them ourselves.

 src/plugins/gs-plugin-apt.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/gs-plugin-apt.c b/src/plugins/gs-plugin-apt.c
index 4f74af5..8b168e0 100644
--- a/src/plugins/gs-plugin-apt.c
+++ b/src/plugins/gs-plugin-apt.c
@@ -402,8 +402,7 @@ done:
 static void
 get_changelog (GsPlugin *plugin, GsApp *app)
 {
-       const gchar *binary_source, *current_version, *update_version;
-       g_autofree gchar *source_prefix = NULL, *uri = NULL, *changelog_prefix = NULL;
+       g_autofree gchar *source_prefix = NULL, *uri = NULL, *changelog_prefix = NULL, *binary_source = NULL, 
*current_version = NULL, *update_version = NULL;
        g_autoptr(SoupMessage) msg = NULL;
        guint status_code;
        g_auto(GStrv) lines = NULL;
@@ -411,9 +410,9 @@ get_changelog (GsPlugin *plugin, GsApp *app)
        GString *details;
 
        // Need to know the source and version to download changelog
-       binary_source = gs_app_get_source_default (app);
-       current_version = gs_app_get_version (app);
-       update_version = gs_app_get_update_version (app);
+       binary_source = g_strdup(gs_app_get_source_default (app));
+       current_version = g_strdup(gs_app_get_version (app));
+       update_version = g_strdup(gs_app_get_update_version (app));
        if (binary_source == NULL || update_version == NULL)
                return;
 


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