From 75e01b80c8ed06976516966242f99d0c323e552b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 3 Apr 2020 20:31:31 +0200 Subject: [PATCH 1/2] Issue #36: Fix memory leaks in set-property function of lib-cell-renderer --- cell-selector/lib-cell-renderer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cell-selector/lib-cell-renderer.c b/cell-selector/lib-cell-renderer.c index 0e53f48..e615efd 100644 --- a/cell-selector/lib-cell-renderer.c +++ b/cell-selector/lib-cell-renderer.c @@ -88,11 +88,13 @@ static void lib_cell_renderer_set_property(GObject *object, g_value_init(&val, G_TYPE_STRING); g_value_set_string(&val, ((struct gds_library *)g_value_get_pointer(value))->name); g_object_set_property(object, "text", &val); + g_value_unset(&val); break; case PROP_CELL: g_value_init(&val, G_TYPE_STRING); g_value_set_string(&val, ((struct gds_cell *)g_value_get_pointer(value))->name); g_object_set_property(object, "text", &val); + g_value_unset(&val); break; case PROP_ERROR_LEVEL: /* Set cell color according to error level */ @@ -100,6 +102,7 @@ static void lib_cell_renderer_set_property(GObject *object, convert_error_level_to_color(&color, g_value_get_uint(value)); g_value_set_boxed(&val, &color); g_object_set_property(object, "foreground-rgba", &val); + g_value_unset(&val); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec); From 00d02b8291a2ac85983e9cee549d5858ea4ac246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Fri, 3 Apr 2020 20:53:32 +0200 Subject: [PATCH 2/2] Issue #36: Fix possible memory leak of async status message, if rendering finishes, before message could be displayed --- output-renderers/gds-output-renderer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/output-renderers/gds-output-renderer.c b/output-renderers/gds-output-renderer.c index 2b296ee..ce7fcb2 100644 --- a/output-renderers/gds-output-renderer.c +++ b/output-renderers/gds-output-renderer.c @@ -100,6 +100,11 @@ static void gds_output_renderer_dispose(GObject *self_obj) if (priv->output_file) g_free(priv->output_file); + if (priv->idle_function_parameters.status_message) { + g_free(priv->idle_function_parameters.status_message); + priv->idle_function_parameters.status_message = NULL; + } + g_clear_object(&priv->layer_settings); /* Chain up to parent class */