Commit d80b6829 authored by Sam Thursfield's avatar Sam Thursfield

Merge branch 'azzaronea/tracker-fix-memory-leaks-tt2sgml' into HEAD

See: !44 (commits)
parents 0ee13ec7 c3318ce1
Pipeline #46818 passed with stage
in 2 minutes and 35 seconds
......@@ -107,7 +107,7 @@ main (gint argc, gchar **argv)
Ontology *ontology = NULL;
OntologyDescription *description = NULL;
GList *description_files, *l;
GFile *ontology_file, *output_file;
g_autoptr(GFile) ontology_file = NULL, output_file = NULL;
gchar *path;
/* Translators: this messagge will apper immediately after the */
......@@ -150,7 +150,7 @@ main (gint argc, gchar **argv)
for (l = description_files; l; l = l->next) {
Ontology *file_ontology = NULL;
GFile *ttl_file, *ttl_output_file;
g_autoptr(GFile) ttl_file = NULL, ttl_output_file = NULL;
gchar *filename;
description = ttl_loader_load_description (l->data);
......@@ -171,9 +171,11 @@ main (gint argc, gchar **argv)
ttl_loader_free_ontology (file_ontology);
ttl_loader_free_description (description);
}
g_list_free_full (description_files, (GDestroyNotify) g_object_unref);
generate_ontology_class_docs (ontology, output_file);
ttl_loader_free_ontology (ontology);
g_option_context_free (context);
return 0;
......
......@@ -45,14 +45,14 @@ ttl_model_class_free (OntologyClass *def)
{
g_free (def->classname);
g_list_foreach (def->superclasses, (GFunc) g_free, NULL);
g_list_foreach (def->subclasses, (GFunc) g_free, NULL);
g_list_foreach (def->in_domain_of, (GFunc) g_free, NULL);
g_list_foreach (def->in_range_of, (GFunc) g_free, NULL);
g_list_free_full (def->superclasses, (GDestroyNotify) g_free);
g_list_free_full (def->subclasses, (GDestroyNotify) g_free);
g_list_free_full (def->in_domain_of, (GDestroyNotify) g_free);
g_list_free_full (def->in_range_of, (GDestroyNotify) g_free);
g_free (def->description);
g_list_foreach (def->instances, (GFunc) g_free, NULL);
g_list_free_full (def->instances, (GDestroyNotify) g_free);
g_free (def);
}
......@@ -84,11 +84,11 @@ ttl_model_property_free (OntologyProperty *def)
{
g_free (def->propertyname);
g_list_foreach (def->type, (GFunc) g_free, NULL);
g_list_foreach (def->domain, (GFunc) g_free, NULL);
g_list_foreach (def->range, (GFunc) g_free, NULL);
g_list_foreach (def->superproperties, (GFunc) g_free, NULL);
g_list_foreach (def->subproperties, (GFunc) g_free, NULL);
g_list_free_full (def->type, (GDestroyNotify) g_free);
g_list_free_full (def->domain, (GDestroyNotify) g_free);
g_list_free_full (def->range, (GDestroyNotify) g_free);
g_list_free_full (def->superproperties, (GDestroyNotify) g_free);
g_list_free_full (def->subproperties, (GDestroyNotify) g_free);
g_free (def->max_cardinality);
g_free (def->description);
......@@ -119,10 +119,11 @@ void
ttl_model_description_free (OntologyDescription *desc)
{
g_free (desc->title);
g_free (desc->description);
g_list_foreach (desc->authors, (GFunc)g_free, NULL);
g_list_foreach (desc->editors, (GFunc)g_free, NULL);
g_list_foreach (desc->contributors, (GFunc)g_free, NULL);
g_list_free_full (desc->authors, (GDestroyNotify) g_free);
g_list_free_full (desc->editors, (GDestroyNotify) g_free);
g_list_free_full (desc->contributors, (GDestroyNotify) g_free);
g_free (desc->gitlog);
g_free (desc->upstream);
......
......@@ -157,6 +157,7 @@ ttl_sgml_print (OntologyDescription *description,
path = g_file_get_path (file);
f = fopen (path, "w");
g_assert (f != NULL);
g_free (path);
upper_name = g_ascii_strup (description->localPrefix, -1);
print_sgml_header (f, description);
......
......@@ -42,9 +42,10 @@ class_get_parent_hierarchy (Ontology *ontology,
*list = g_list_prepend (*list, (gpointer) class_name);
klass = g_hash_table_lookup (ontology->classes, class_name);
if (!klass) {
klass = ttl_model_class_new (class_name);
g_hash_table_insert (ontology->classes, klass->classname, klass);
g_hash_table_insert (ontology->classes, g_strdup (klass->classname), klass);
return;
}
......@@ -194,6 +195,7 @@ print_fts_properties (FILE *f,
g_fprintf (f, "</itemizedlist></para></refsect1>\n");
g_free (shortname);
g_free (id);
g_list_free (fts_props);
}
typedef struct {
......@@ -310,6 +312,7 @@ hierarchy_context_new (OntologyClass *klass,
static void
hierarchy_context_free (HierarchyContext *context)
{
g_list_free (context->hierarchy);
g_ptr_array_unref (context->strings);
g_hash_table_unref (context->placed);
g_hash_table_unref (context->resolved_parents);
......@@ -505,7 +508,7 @@ class_get_parent_hierarchy_strings (OntologyClass *klass,
{
HierarchyContext *context;
GList *c;
GPtrArray *strings;
GPtrArray *strings = NULL;
context = hierarchy_context_new (klass, ontology);
......@@ -619,7 +622,7 @@ print_properties (FILE *f,
if (!superprop) {
superprop = ttl_model_property_new (l->data);
g_hash_table_insert (ontology->properties, superprop->propertyname, superprop);
g_hash_table_insert (ontology->properties, g_strdup (superprop->propertyname), superprop);
}
if (!superprop->domain)
......@@ -692,6 +695,7 @@ generate_ontology_class_docs (Ontology *ontology,
child = g_file_get_child (output_dir, class_filename);
output_file = g_file_get_path (child);
g_object_unref (child);
f = fopen (output_file, "w");
......
Markdown is supported
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