diff options
author | Haithem BEN GHORBAL <haithem.benghorbal@gmail.com> | 2016-02-08 16:57:48 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2016-02-15 17:37:58 +0100 |
commit | b3b3cbb45ec27b13a8dbbd71b6a04c8376a20412 (patch) | |
tree | 6e8a27f10bcaae2bf99caad66c7417c659d0ea35 | |
parent | 2a568fa218192ed50c5fe90304e8f83faf1f2cc2 (diff) | |
download | tracker-b3b3cbb45ec27b13a8dbbd71b6a04c8376a20412.tar.gz |
libtracker-fts: Fix invalid blob length calculation
The blob lenght is defined to be in bytes.
-rw-r--r-- | src/libtracker-fts/tracker-fts.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libtracker-fts/tracker-fts.c b/src/libtracker-fts/tracker-fts.c index a385d6cc1..0571fb0f4 100644 --- a/src/libtracker-fts/tracker-fts.c +++ b/src/libtracker-fts/tracker-fts.c @@ -159,6 +159,7 @@ function_weights (sqlite3_context *context, { static guint *weights = NULL; static GMutex mutex; + static gint length; int rc = SQLITE_DONE; g_mutex_lock (&mutex); @@ -190,6 +191,7 @@ function_weights (sqlite3_context *context, sqlite3_finalize (stmt); if (rc == SQLITE_DONE) { + length = weight_array->len * g_array_get_element_size (weight_array); weights = (guint *) g_array_free (weight_array, FALSE); } else { g_array_free (weight_array, TRUE); @@ -199,7 +201,7 @@ function_weights (sqlite3_context *context, g_mutex_unlock (&mutex); if (rc == SQLITE_DONE) - sqlite3_result_blob (context, weights, sizeof (weights), NULL); + sqlite3_result_blob (context, weights, length, NULL); else sqlite3_result_error_code (context, rc); } @@ -210,9 +212,11 @@ function_property_names (sqlite3_context *context, sqlite3_value *argv[]) { gchar **property_names; + gint length; property_names = g_private_get (&property_names_key); - sqlite3_result_blob (context, property_names, sizeof (property_names), NULL); + length = g_strv_length (property_names) * sizeof (gchar *); + sqlite3_result_blob (context, property_names, length, NULL); } static void |