[tracker: 27/30] extract, msoffice: call g_free() on the right pointer



commit b42f7cef35d141598463fc782fcd8c2ed8caaa30
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Jan 20 20:15:35 2014 +0100

    extract,msoffice: call g_free() on the right pointer
    
    the "keyw" variable ends up pointing to chunks within the string
    that must be freed, so keep a pointer to the original string
    so it can be freed afterwards.

 src/tracker-extract/tracker-extract-msoffice.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-msoffice.c b/src/tracker-extract/tracker-extract-msoffice.c
index ec4a6a5..da183ef 100644
--- a/src/tracker-extract/tracker-extract-msoffice.c
+++ b/src/tracker-extract/tracker-extract-msoffice.c
@@ -290,11 +290,11 @@ summary_metadata_cb (gpointer key,
        } else if (g_strcmp0 (key, "dc:creator") == 0) {
                metadata_add_gvalue (info->metadata, info->uri, "nco:creator", val, "nco:Contact", 
"nco:fullname", FALSE);
        } else if (g_strcmp0 (key, "dc:keywords") == 0) {
-               gchar *keywords = g_strdup_value_contents (val);
+               gchar *keywords, *str = g_strdup_value_contents (val);
                gchar *lasts, *keyw;
                size_t len;
 
-               keyw = keywords;
+               keyw = keywords = str;
                keywords = strchr (keywords, '"');
 
                if (keywords) {
@@ -314,7 +314,7 @@ summary_metadata_cb (gpointer key,
                        tracker_sparql_builder_object_unvalidated (info->metadata, keyw);
                }
 
-               g_free (keyw);
+               g_free (str);
        } else if (g_strcmp0 (key, "dc:description") == 0) {
                metadata_add_gvalue (info->metadata, info->uri, "nie:comment", val, NULL, NULL, FALSE);
        } else if (g_strcmp0 (key, "gsf:page-count") == 0) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]