]> git.cworth.org Git - acre/blobdiff - acre.c
Close up some memory leaks.
[acre] / acre.c
diff --git a/acre.c b/acre.c
index 5e341fd77b8707bd67fbdd07ced58cce149030f4..5ac51bfae1c7f34c148d64013065d5b7c874cae8 100644 (file)
--- a/acre.c
+++ b/acre.c
@@ -134,6 +134,7 @@ acre_create (void)
     acre->font = NULL;
     acre->colors = NULL;
     acre->num_colors = 0;
+    acre->colors_size = 0;
 
     acre->width = 0;
     acre->height = 0;
@@ -347,6 +348,9 @@ _create_layout (acre_t *acre, const char *text)
 {
     PangoLayout *layout;
 
+    if (text == NULL)
+           text = "";
+
     layout = pango_cairo_create_layout (acre->cr);
     pango_layout_set_font_description (layout, acre->font);
     pango_layout_set_text (layout, text, -1);
@@ -432,6 +436,7 @@ _draw_title_and_labels (acre_t *acre)
 
     title_layout = _create_layout (acre, acre->title);
     pango_layout_set_font_description (title_layout, title_font);
+    pango_font_description_free (title_font);
 
     x_axis_layout = _create_layout (acre, acre->x_axis.label);
     y_axis_layout = _create_layout (acre, acre->y_axis.label);
@@ -1049,6 +1054,8 @@ acre_data_create (void)
 void
 acre_data_destroy (acre_data_t *data)
 {
+    free (data->name);
+
     free (data->points);
 
     free (data);