]> saetta.ns0.it Git - zakaudit/libzakaudit/commitdiff
Added functions to free resources.
authorAndrea Zagli <azagli@libero.it>
Sun, 22 Dec 2019 10:25:21 +0000 (11:25 +0100)
committerAndrea Zagli <azagli@libero.it>
Sun, 22 Dec 2019 10:25:21 +0000 (11:25 +0100)
src/audit.c

index 8413587c4bfd1436cb2ea55c67d3d8d49623e2ea..932a1fd660b8d32f4ad1b265c7ef28bb4182c4d6 100644 (file)
@@ -242,6 +242,43 @@ zak_audit_init (ZakAudit *zak_audit)
        priv->gtkbuilder = gtk_builder_new ();
 }
 
+static void
+free_field (gpointer data)
+{
+       Field *f;
+
+       f = (Field *)data;
+
+       g_free (f->name);
+}
+
+static void
+free_table (gpointer data)
+{
+       Table *t;
+
+       t = (Table *)data;
+
+       g_free (t->name);
+       g_list_free_full (t->fields, free_field);
+       g_free (t->fields_sql);
+       g_list_free_full (t->keys, free_field);
+       g_free (t->keys_sql);
+}
+
+static void
+free_datasource (gpointer data)
+{
+       Datasource *d;
+
+       d = (Datasource *)data;
+
+       g_free (d->name);
+       g_free (d->cnc_string);
+       g_free (d->gdaex);
+       g_list_free_full (d->tables, free_table);
+}
+
 static gboolean
 load_fields (ZakAudit *zak_audit,
              Datasource *datasource,
@@ -403,6 +440,8 @@ load_datasources (ZakAudit *zak_audit, va_list ap)
 
        str_in = NULL;
 
+       g_list_free_full (priv->datasources, free_datasource);
+
        datasource_name = va_arg (ap, char *);
        if (datasource_name != NULL)
                {