Commit 61530c74 authored by Massimo Valentini's avatar Massimo Valentini
Browse files

app: plug a memory leak

AddressSanitizer output (paths manually shortened)

Direct leak of 96 byte(s) in 1 object(s) allocated from:
    #0 0x7f543247d1d0 in realloc (/lib64/libasan.so.3+0xc71d0)
    #1 0x7f542d3ad02f in g_realloc glib/glib/gmem.c:159
    #2 0x57918d in gimp_color_history_set_property gimp/app/widgets/gimpcolorhistory.c:169
    #3 0x7f542d681ec0 in object_set_property glib/gobject/gobject.c:1423
    #4 0x7f542d681ec0 in g_object_new_internal glib/gobject/gobject.c:1817
    #5 0x7f542d6839ed in g_object_new_valist glib/gobject/gobject.c:2042
    #6 0x7f542d683c73 in g_object_new glib/gobject/gobject.c:1626
parent ab328ec7
......@@ -57,6 +57,7 @@ enum
#define COLOR_AREA_SIZE 20
static void gimp_color_history_constructed (GObject *object);
static void gimp_color_history_finalize (GObject *object);
static void gimp_color_history_set_property (GObject *object,
guint property_id,
const GValue *value,
......@@ -90,6 +91,7 @@ gimp_color_history_class_init (GimpColorHistoryClass *klass)
object_class->constructed = gimp_color_history_constructed;
object_class->set_property = gimp_color_history_set_property;
object_class->get_property = gimp_color_history_get_property;
object_class->finalize = gimp_color_history_finalize;
history_signals[COLOR_SELECTED] =
g_signal_new ("color-selected",
......@@ -140,6 +142,17 @@ gimp_color_history_constructed (GObject *object)
gimp_color_history_palette_dirty (palette, history);
}
static void
gimp_color_history_finalize (GObject *object)
{
GimpColorHistory *history = GIMP_COLOR_HISTORY (object);
g_free (history->color_areas);
history->color_areas = NULL;
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_color_history_set_property (GObject *object,
guint property_id,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment