Commit 58706035 authored by Carlos Garnacho's avatar Carlos Garnacho

Merge branch 'azzaronea/fix-issue-67'

parents bd00a0ed 5f484f89
Pipeline #60107 passed with stage
in 2 minutes and 19 seconds
......@@ -5012,6 +5012,7 @@ tracker_data_manager_finalize (GObject *object)
g_clear_object (&manager->ontologies);
g_clear_object (&manager->data_update);
g_free (manager->status);
G_OBJECT_CLASS (tracker_data_manager_parent_class)->finalize (object);
}
......
......@@ -1703,6 +1703,7 @@ tracker_db_interface_sqlite_fts_init (TrackerDBInterface *db_interface,
fts_columns[i]);
}
g_free (db_interface->fts_properties);
db_interface->fts_properties = g_string_free (fts_properties,
FALSE);
g_strfreev (fts_columns);
......@@ -2267,6 +2268,7 @@ tracker_db_interface_create_statement (TrackerDBInterface *db_interfac
error);
if (!sqlite_stmt) {
tracker_db_interface_unlock (db_interface);
g_free (full_query);
return NULL;
}
......
......@@ -1780,10 +1780,11 @@ tracker_db_journal_reader_verify_last (GFile *data_location,
jreader.current = jreader.end - entry_size_check;
success = db_journal_reader_next (&jreader, FALSE, NULL);
db_journal_reader_clear (&jreader);
} else {
success = TRUE;
}
db_journal_reader_clear (&jreader);
}
g_free (filename);
......
......@@ -790,7 +790,7 @@ static const TrackerGrammarRule helper_BuiltInCall_or_2[] = { S(helper_BuiltInCa
S(helper_BuiltInCall_seq_47), S(helper_BuiltInCall_seq_48), S(helper_BuiltInCall_seq_49),
S(helper_BuiltInCall_seq_50), S(helper_BuiltInCall_seq_51), S(helper_BuiltInCall_seq_52),
S(helper_BuiltInCall_seq_53), S(helper_BuiltInCall_seq_54), S(helper_BuiltInCall_seq_55),
S(helper_BuiltInCall_seq_56)};
S(helper_BuiltInCall_seq_56), NIL };
static const TrackerGrammarRule rule_BuiltInCall[] = { OR(helper_BuiltInCall_or_2), NIL };
/* BrackettedExpression ::= '(' Expression ')'
......
......@@ -270,8 +270,10 @@ tracker_sparql_expand_prefix (TrackerSparql *sparql,
g_hash_table_insert (sparql->prefix_map, g_strdup (ns), expanded_ns);
}
if (!expanded_ns)
if (!expanded_ns) {
g_free (ns);
return NULL;
}
}
g_free (ns);
......@@ -4060,8 +4062,6 @@ translate_PathElt (TrackerSparql *sparql,
/* PathElt ::= PathPrimary PathMod?
*/
_call_rule (sparql, NAMED_RULE_PathPrimary, error);
_init_token (&sparql->current_state.predicate,
sparql->current_state.prev_node, sparql);
if (_check_in_rule (sparql, NAMED_RULE_PathMod)) {
_call_rule (sparql, NAMED_RULE_PathMod, error);
......
......@@ -17,6 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
using GLib;
public class Tracker.TurtleReader : Object {
SparqlScanner scanner;
......@@ -56,8 +58,8 @@ public class Tracker.TurtleReader : Object {
HashTable<string,string> prefix_map;
string[] subject_stack;
string[] predicate_stack;
GLib.Queue<string> subject_stack;
GLib.Queue<string> predicate_stack;
int bnodeid = 0;
// base UUID used for blank nodes
......@@ -88,6 +90,8 @@ public class Tracker.TurtleReader : Object {
tokens = new TokenInfo[BUFFER_SIZE];
prefix_map = new HashTable<string,string>.full (str_hash, str_equal, g_free, g_free);
subject_stack = new GLib.Queue<string> ();
predicate_stack = new GLib.Queue<string> ();
}
private string generate_bnodeid (string? user_bnodeid) {
......@@ -266,8 +270,8 @@ public class Tracker.TurtleReader : Object {
return true;
} else if (accept (SparqlTokenType.OPEN_BRACKET)) {
// begin of anonymous blank node
subject_stack += subject;
predicate_stack += predicate;
subject_stack.push_tail (subject);
predicate_stack.push_tail (predicate);
subject = generate_bnodeid (null);
state = State.SUBJECT;
continue;
......@@ -355,18 +359,15 @@ public class Tracker.TurtleReader : Object {
}
state = State.SUBJECT;
continue;
} else if (subject_stack.length > 0) {
} else if (!subject_stack.is_empty()) {
// end of anonymous blank node
expect (SparqlTokenType.CLOSE_BRACKET);
object = subject;
object_is_uri = true;
subject = subject_stack[subject_stack.length - 1];
subject_stack.length--;
predicate = predicate_stack[predicate_stack.length - 1];
predicate_stack.length--;
subject = subject_stack.pop_tail();
predicate = predicate_stack.pop_tail();
state = State.OBJECT;
return true;
......
......@@ -569,6 +569,7 @@ update_array_async_thread_func (GTask *task,
tracker_sparql_connection_update (source_object, concatenated,
g_task_get_priority (task),
cancellable, &error);
g_free (concatenated);
if (!error) {
g_task_return_pointer (task, errors,
......
......@@ -314,6 +314,7 @@ tracker_monitor_finalize (GObject *object)
g_hash_table_unref (priv->cached_events);
g_hash_table_unref (priv->monitors);
g_clear_object (&priv->tree);
G_OBJECT_CLASS (tracker_monitor_parent_class)->finalize (object);
}
......
......@@ -90,6 +90,10 @@ test_string_to_date (void)
g_assert_cmpint (g_date_get_day (expected), ==, g_date_get_day (result));
g_assert_cmpint (g_date_get_month (expected), ==, g_date_get_month (result));
g_date_free (expected);
g_date_free (result);
result_time_t = tracker_string_to_date ("", NULL, &error);
g_assert_cmpint (result_time_t, ==, -1);
g_assert_error (error, TRACKER_DATE_ERROR, TRACKER_DATE_ERROR_INVALID_ISO8601);
......@@ -137,6 +141,9 @@ test_date_to_string (void)
result = tracker_date_to_string (input);
g_assert (result != NULL && strncmp (result, "2008-06-16T23:53:10Z", 19) == 0);
g_free (result);
g_free (original);
}
static void
......
......@@ -165,6 +165,7 @@ test_path_evaluate_name (void)
result = tracker_path_evaluate_name ("just-a-filename");
g_assert_cmpstr (result, ==, "just-a-filename");
g_free (result);
result = tracker_path_evaluate_name ("$HOME/all/dir/");
expected = g_build_path (G_DIR_SEPARATOR_S, home, "/all/dir", NULL);
......@@ -200,21 +201,25 @@ test_path_evaluate_name (void)
result = tracker_path_evaluate_name ("");
g_assert (!result);
g_free (result);
result = tracker_path_evaluate_name (NULL);
g_assert (!result);
g_free (result);
g_setenv ("HOME", "", TRUE);
result = tracker_path_evaluate_name ("~/but-no-home.txt");
g_assert (!result);
g_free (result);
g_setenv ("HOME", home, TRUE);
result = tracker_path_evaluate_name ("$UNDEFINED/something");
g_assert_cmpstr (result, ==, "/something");
g_free (result);
result = tracker_path_evaluate_name (tracker_test_helpers_get_nonutf8 ());
g_assert_cmpstr (result, ==, tracker_test_helpers_get_nonutf8 ());
g_free (result);
g_free (home);
g_free (pwd);
......
......@@ -56,6 +56,7 @@ test_string_in_string_list (void)
g_assert_cmpint (tracker_string_in_string_list ("is", pieces), ==, 1);
g_assert_cmpint (tracker_string_in_string_list ("Audio:Title", pieces), ==, 12);
g_strfreev (pieces);
g_assert_cmpint (tracker_string_in_string_list ("terms", NULL), ==, -1);
}
......@@ -143,6 +144,7 @@ test_string_to_string_list (void)
result = tracker_string_to_string_list (input);
g_assert_cmpint (g_strv_length (result), ==, 1);
g_assert_cmpstr (result [0], ==, "first line");
g_strfreev (result);
}
static void
......
......@@ -216,6 +216,8 @@ test_backup_and_restore_helper (const gchar *db_location,
g_assert_cmpint (backup_calls, ==, 1);
g_free (data_prefix);
g_object_unref (data_location);
g_object_unref (manager);
}
......
......@@ -284,6 +284,7 @@ test_ontology_change (void)
g_free (ontologies);
g_free (build_prefix);
g_free (prefix);
g_free (ontology_file);
}
int
......
......@@ -321,13 +321,14 @@ test_common_context_teardown (TestCommonContext *fixture,
g_object_unref (fixture->test_file);
}
DELETE_FOLDER (fixture, NULL);
if (fixture->test_path) {
g_free (fixture->test_path);
}
g_clear_object (&fixture->connection);
DELETE_FOLDER (fixture, NULL);
g_main_loop_unref (fixture->main_loop);
}
static gboolean
......
......@@ -130,6 +130,11 @@ test_priority_queue_find (void)
g_assert_cmpstr (result, !=, NULL);
g_assert_cmpint (priority, ==, 10);
while (!tracker_priority_queue_is_empty (queue)) {
gchar *text = (gchar *) tracker_priority_queue_pop (queue, NULL);
g_free (text);
}
tracker_priority_queue_unref (queue);
}
......@@ -157,6 +162,11 @@ test_priority_queue_foreach (void)
g_assert_cmpint (counter, ==, 3);
while (!tracker_priority_queue_is_empty (queue)) {
gchar *text = (gchar *) tracker_priority_queue_pop (queue, NULL);
g_free (text);
}
tracker_priority_queue_unref (queue);
}
......
......@@ -73,7 +73,7 @@ test_resource_get_set_gvalue (void)
resource = tracker_resource_new ("http://example.com/resource");
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, "xyzzy");
g_value_set_static_string (&value, "xyzzy");
tracker_resource_set_gvalue (resource, "http://example.com/0", &value);
list = tracker_resource_get_values (resource, "http://example.com/0");
......
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