[gnome-software] trivial: Fix a memory leak in gs_app_to_string()



commit 34e809785d9b3b62a38b57775524fe3dbbdd298b
Author: Richard Hughes <richard hughsie com>
Date:   Tue Jun 28 10:33:55 2016 +0100

    trivial: Fix a memory leak in gs_app_to_string()

 src/gs-app.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index d59547a..dc3f2ae 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -254,7 +254,10 @@ gs_app_to_string (GsApp *app)
        if (app->last_error != NULL)
                gs_app_kv_lpad (str, "last-error", app->last_error->message);
        gs_app_kv_lpad (str, "state", as_app_state_to_string (app->state));
-       gs_app_kv_lpad (str, "quirk", _as_app_quirk_to_string (app->quirk));
+       if (app->quirk > 0) {
+               g_autofree gchar *qstr = _as_app_quirk_to_string (app->quirk);
+               gs_app_kv_lpad (str, "quirk", qstr);
+       }
        if (app->progress > 0)
                gs_app_kv_printf (str, "progress", "%i%%", app->progress);
        if (app->id != NULL)


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