[tracker/rss-enclosures] tracker-extract, libtracker-extract: Refactored memory usage in extractors



commit 621eca645b132c8aa0aa635b3490777ed3ce30a0
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Apr 13 15:12:12 2010 +0200

    tracker-extract, libtracker-extract: Refactored memory usage in extractors

 .../libtracker-extract/tracker-extract-mockup.c    |   17 +-
 src/libtracker-extract/tracker-exif.c              |   55 ++--
 src/libtracker-extract/tracker-exif.h              |   18 +-
 src/libtracker-extract/tracker-iptc.c              |   31 +--
 src/libtracker-extract/tracker-iptc.h              |   18 +-
 src/libtracker-extract/tracker-utils.c             |  100 +++++++-
 src/libtracker-extract/tracker-utils.h             |   30 ++-
 src/libtracker-extract/tracker-xmp.c               |  133 ++++------
 src/libtracker-extract/tracker-xmp.h               |   26 +-
 src/tracker-extract/tracker-extract-flac.c         |   58 ++--
 src/tracker-extract/tracker-extract-gstreamer.c    |   14 +-
 src/tracker-extract/tracker-extract-jpeg.c         |  152 ++++-------
 src/tracker-extract/tracker-extract-mp3.c          |  169 ++++++++-----
 src/tracker-extract/tracker-extract-pdf.c          |  252 ++++++++----------
 src/tracker-extract/tracker-extract-png.c          |  277 +++++++++-----------
 src/tracker-extract/tracker-extract-tiff.c         |  185 ++++++--------
 src/tracker-extract/tracker-extract-vorbis.c       |    6 +-
 src/tracker-extract/tracker-extract-xmp.c          |    8 +-
 18 files changed, 771 insertions(+), 778 deletions(-)
---
diff --git a/examples/libtracker-extract/tracker-extract-mockup.c b/examples/libtracker-extract/tracker-extract-mockup.c
index c0f94c4..38ef50d 100644
--- a/examples/libtracker-extract/tracker-extract-mockup.c
+++ b/examples/libtracker-extract/tracker-extract-mockup.c
@@ -59,10 +59,10 @@ extract_mockup (const gchar          *uri,
 	gchar *lyricist_unknown;
 
 	/* Coalesced input */
-	gchar *title;
+	const gchar *title;
 	gchar *performer;
 	gchar *performer_uri;
-	gchar *lyricist;
+	const gchar *lyricist;
 	gchar *lyricist_uri;
 	gchar *album;
 	gchar *album_uri;
@@ -132,8 +132,8 @@ extract_mockup (const gchar          *uri,
 	fclose (f);
 
 	/* TODO: Make sure we coalesce duplicate values */
-	title = tracker_coalesce (4, title_tagv1, title_tagv2, title_tagv3, title_unknown);
-	lyricist = tracker_coalesce (2, lyricist_tagv2, lyricist_unknown);
+	title = tracker_coalesce_strip (4, title_tagv1, title_tagv2, title_tagv3, title_unknown);
+	lyricist = tracker_coalesce_strip (2, lyricist_tagv2, lyricist_unknown);
 
 	performer = g_strdup ("Stone Gods");
 	composer = NULL;
@@ -241,7 +241,6 @@ extract_mockup (const gchar          *uri,
 	if (title) {
 		tracker_sparql_builder_predicate (metadata, "nie:title");
 		tracker_sparql_builder_object_unvalidated (metadata, title);
-		g_free (title);
 	}
 
 	if (lyricist_uri) {
@@ -321,6 +320,14 @@ extract_mockup (const gchar          *uri,
 	}
 
 	/* TODO: Clean up */
+	g_free (title_tagv1);
+	g_free (title_tagv2);
+	g_free (title_tagv3);
+	g_free (title_unknown);
+
+	g_free (lyricist_tagv2);
+	g_free (lyricist_unknown);
+
 	g_free (album);
 	g_free (composer);
 	g_free (performer);
diff --git a/src/libtracker-extract/tracker-exif.c b/src/libtracker-extract/tracker-exif.c
index 75d756a..f9ea24b 100644
--- a/src/libtracker-extract/tracker-exif.c
+++ b/src/libtracker-extract/tracker-exif.c
@@ -438,7 +438,7 @@ tracker_exif_new (const guchar *buffer,
 	data = g_new0 (TrackerExifData, 1);
 
 	if (!parse_exif (buffer, len, uri, data)) {
-		tracker_exif_free (data, TRUE);
+		tracker_exif_free (data);
 		return NULL;
 	}
 
@@ -456,34 +456,33 @@ tracker_exif_new (const guchar *buffer,
  * Since: 0.9
  **/
 void
-tracker_exif_free (TrackerExifData *data,
-                   gboolean         free_members)
+tracker_exif_free (TrackerExifData *data)
 {
-	if (free_members) {
-		g_free (data->y_dimension);
-		g_free (data->x_dimension);
-		g_free (data->image_width);
-		g_free (data->document_name);
-		g_free (data->time);
-		g_free (data->time_original);
-		g_free (data->artist);
-		g_free (data->user_comment);
-		g_free (data->description);
-		g_free (data->make);
-		g_free (data->model);
-		g_free (data->orientation);
-		g_free (data->exposure_time);
-		g_free (data->fnumber);
-		g_free (data->flash);
-		g_free (data->focal_length);
-		g_free (data->iso_speed_ratings);
-		g_free (data->metering_mode);
-		g_free (data->white_balance);
-		g_free (data->copyright);
-		g_free (data->software);
-		g_free (data->x_resolution);
-		g_free (data->y_resolution);
-	}
+	g_return_if_fail (data != NULL);
+
+	g_free (data->y_dimension);
+	g_free (data->x_dimension);
+	g_free (data->image_width);
+	g_free (data->document_name);
+	g_free (data->time);
+	g_free (data->time_original);
+	g_free (data->artist);
+	g_free (data->user_comment);
+	g_free (data->description);
+	g_free (data->make);
+	g_free (data->model);
+	g_free (data->orientation);
+	g_free (data->exposure_time);
+	g_free (data->fnumber);
+	g_free (data->flash);
+	g_free (data->focal_length);
+	g_free (data->iso_speed_ratings);
+	g_free (data->metering_mode);
+	g_free (data->white_balance);
+	g_free (data->copyright);
+	g_free (data->software);
+	g_free (data->x_resolution);
+	g_free (data->y_resolution);
 
 	g_free (data);
 }
diff --git a/src/libtracker-extract/tracker-exif.h b/src/libtracker-extract/tracker-exif.h
index 2495ae2..c50be2a 100644
--- a/src/libtracker-extract/tracker-exif.h
+++ b/src/libtracker-extract/tracker-exif.h
@@ -56,19 +56,17 @@ typedef struct {
 
 #ifndef TRACKER_DISABLE_DEPRECATED
 
-gboolean tracker_exif_read (const unsigned char *buffer,
-                            size_t               len,
-                            const gchar         *uri,
-                            TrackerExifData     *data) G_GNUC_DEPRECATED;
+gboolean          tracker_exif_read  (const unsigned char *buffer,
+                                      size_t               len,
+                                      const gchar         *uri,
+                                      TrackerExifData     *data) G_GNUC_DEPRECATED;
 
 #endif /* TRACKER_DISABLE_DEPRECATED */
 
-TrackerExifData * tracker_exif_new (const guchar *buffer,
-                                    size_t        len,
-                                    const gchar  *uri);
-
-void tracker_exif_free (TrackerExifData *data,
-                        gboolean         free_members);
+TrackerExifData * tracker_exif_new   (const guchar *buffer,
+                                      size_t        len,
+                                      const gchar  *uri);
+void              tracker_exif_free  (TrackerExifData *data);
 
 G_END_DECLS
 
diff --git a/src/libtracker-extract/tracker-iptc.c b/src/libtracker-extract/tracker-iptc.c
index 78d2169..deefddd 100644
--- a/src/libtracker-extract/tracker-iptc.c
+++ b/src/libtracker-extract/tracker-iptc.c
@@ -276,7 +276,7 @@ tracker_iptc_new (const guchar *buffer,
 	data = g_new0 (TrackerIptcData, 1);
 
 	if (!parse_iptc (buffer, len, uri, data)) {
-		tracker_iptc_free (data, TRUE);
+		tracker_iptc_free (data);
 		return NULL;
 	}
 
@@ -294,25 +294,22 @@ tracker_iptc_new (const guchar *buffer,
  * Since: 0.9
  **/
 void
-tracker_iptc_free (TrackerIptcData *data,
-                   gboolean         free_members)
+tracker_iptc_free (TrackerIptcData *data)
 {
 	g_return_if_fail (data != NULL);
 
-	if (free_members) {
-		g_free (data->keywords);
-		g_free (data->date_created);
-		g_free (data->byline);
-		g_free (data->credit);
-		g_free (data->copyright_notice);
-		g_free (data->image_orientation);
-		g_free (data->byline_title);
-		g_free (data->city);
-		g_free (data->state);
-		g_free (data->sublocation);
-		g_free (data->country_name);
-		g_free (data->contact);
-	}
+	g_free (data->keywords);
+	g_free (data->date_created);
+	g_free (data->byline);
+	g_free (data->credit);
+	g_free (data->copyright_notice);
+	g_free (data->image_orientation);
+	g_free (data->byline_title);
+	g_free (data->city);
+	g_free (data->state);
+	g_free (data->sublocation);
+	g_free (data->country_name);
+	g_free (data->contact);
 
 	g_free (data);
 }
diff --git a/src/libtracker-extract/tracker-iptc.h b/src/libtracker-extract/tracker-iptc.h
index f364127..b8ed67a 100644
--- a/src/libtracker-extract/tracker-iptc.h
+++ b/src/libtracker-extract/tracker-iptc.h
@@ -47,19 +47,17 @@ typedef struct {
 
 #ifndef TRACKER_DISABLE_DEPRECATED
 
-gboolean tracker_iptc_read (const unsigned char *buffer,
-                            size_t               len,
-                            const gchar         *uri,
-                            TrackerIptcData     *data) G_GNUC_DEPRECATED;
+gboolean          tracker_iptc_read  (const unsigned char *buffer,
+                                      size_t               len,
+                                      const gchar         *uri,
+                                      TrackerIptcData     *data) G_GNUC_DEPRECATED;
 
 #endif /* TRACKER_DISABLE_DEPRECATED */
 
-TrackerIptcData * tracker_iptc_new (const guchar *buffer,
-                                    gsize         len,
-                                    const gchar  *uri);
-
-void tracker_iptc_free (TrackerIptcData *data,
-                        gboolean         free_members);
+TrackerIptcData * tracker_iptc_new   (const guchar *buffer,
+                                      gsize         len,
+                                      const gchar  *uri);
+void              tracker_iptc_free  (TrackerIptcData *data);
 
 G_END_DECLS
 
diff --git a/src/libtracker-extract/tracker-utils.c b/src/libtracker-extract/tracker-utils.c
index 91b2196..9b7c453 100644
--- a/src/libtracker-extract/tracker-utils.c
+++ b/src/libtracker-extract/tracker-utils.c
@@ -53,6 +53,49 @@ static const char imonths[] = {
 	'6', '7', '8', '9', '0', '1', '2'
 };
 
+
+/**
+ * tracker_coalesce_strip:
+ * @n_values: the number of @Varargs supplied
+ * @Varargs: the string pointers to coalesce
+ *
+ * This function iterates through a series of string pointers passed
+ * using @Varargs and returns the first which is not %NULL, not empty
+ * (i.e. "") and not comprised of one or more spaces (i.e. " ").
+ *
+ * The returned value is stripped using g_strstrip(). It is MOST
+ * important NOT to pass constant string pointers to this function!
+ *
+ * Returns: the first string pointer from those provided which
+ * matches, otherwise %NULL.
+ *
+ * Since: 0.9
+ **/
+const gchar *
+tracker_coalesce_strip (gint n_values,
+                        ...)
+{
+	va_list args;
+	gint    i;
+	const gchar *result = NULL;
+
+	va_start (args, n_values);
+
+	for (i = 0; i < n_values; i++) {
+		gchar *value;
+
+		value = va_arg (args, gchar *);
+		if (!result && !tracker_is_blank_string (value)) {
+			result = (const gchar *) g_strstrip (value);
+			break;
+		}
+	}
+
+	va_end (args);
+
+	return result;
+}
+
 /**
  * tracker_coalesce:
  * @n_values: the number of @Varargs supplied
@@ -97,8 +140,9 @@ tracker_coalesce (gint n_values,
 	return result;
 }
 
+
 /**
- * tracker_merge:
+ * tracker_merge_const:
  * @delimiter: the delimiter to use when merging
  * @n_values: the number of @Varargs supplied
  * @Varargs: the string pointers to merge
@@ -113,6 +157,60 @@ tracker_coalesce (gint n_values,
  * Returns: a newly-allocated string holding the result which should
  * be freed with g_free() when finished with, otherwise %NULL.
  *
+ * Since: 0.9
+ **/
+gchar *
+tracker_merge_const (const gchar *delimiter, 
+                     gint         n_values,
+                     ...)
+{
+	va_list args;
+	gint    i;
+	GString *str = NULL;
+
+	va_start (args, n_values);
+
+	for (i = 0; i < n_values; i++) {
+		gchar *value;
+
+		value = va_arg (args, gchar *);
+		if (value) {
+			if (!str) {
+				str = g_string_new (value);
+			} else {
+				if (delimiter) {
+					g_string_append (str, delimiter);
+				}
+				g_string_append (str, value);
+			}
+		}
+	}
+
+	va_end (args);
+
+	if (!str) {
+		return NULL;
+	}
+
+	return g_string_free (str, FALSE);
+}
+
+/**
+ * tracker_merge:
+ * @delimiter: the delimiter to use when merging
+ * @n_values: the number of @Varargs supplied
+ * @Varargs: the string pointers to merge
+ *
+ * This function iterates through a series of string pointers passed
+ * using @Varargs and returns a newly allocated string of the merged
+ * strings. All passed strings are freed (don't pass const values)/
+ *
+ * The @delimiter can be %NULL. If specified, it will be used in
+ * between each merged string in the result.
+ *
+ * Returns: a newly-allocated string holding the result which should
+ * be freed with g_free() when finished with, otherwise %NULL.
+ *
  * Since: 0.8
  **/
 gchar *
diff --git a/src/libtracker-extract/tracker-utils.h b/src/libtracker-extract/tracker-utils.h
index 7f83377..052b2dd 100644
--- a/src/libtracker-extract/tracker-utils.h
+++ b/src/libtracker-extract/tracker-utils.h
@@ -26,17 +26,25 @@
 
 G_BEGIN_DECLS
 
-gchar *tracker_coalesce               (gint         n_values,
-                                       ...);
-gchar *tracker_merge                  (const gchar *delimiter,
-                                       gint         n_values,
-                                       ...);
-gchar *tracker_text_normalize         (const gchar *text,
-                                       guint        max_words,
-                                       guint       *n_words);
-gchar *tracker_date_guess             (const gchar *date_string);
-gchar *tracker_date_format_to_iso8601 (const gchar *date_string,
-                                       const gchar *format);
+#ifndef TRACKER_DISABLE_DEPRECATED
+gchar*       tracker_coalesce               (gint         n_values,
+                                                          ...) G_GNUC_DEPRECATED;
+gchar*       tracker_merge                  (const gchar *delimiter,
+                                             gint         n_values,
+                                                          ...) G_GNUC_DEPRECATED;
+#endif /* TRACKER_DISABLE_DEPRECATED */
+
+gchar*       tracker_text_normalize         (const gchar *text,
+                                             guint        max_words,
+                                             guint       *n_words);
+gchar*       tracker_date_guess             (const gchar *date_string);
+gchar*       tracker_date_format_to_iso8601 (const gchar *date_string,
+                                             const gchar *format);
+const gchar* tracker_coalesce_strip         (gint         n_values,
+                                                          ...);
+gchar*       tracker_merge_const            (const gchar *delimiter, 
+                                             gint         n_values,
+                                                          ...);
 
 G_END_DECLS
 
diff --git a/src/libtracker-extract/tracker-xmp.c b/src/libtracker-extract/tracker-xmp.c
index afd7ab4..191a043 100644
--- a/src/libtracker-extract/tracker-xmp.c
+++ b/src/libtracker-extract/tracker-xmp.c
@@ -544,7 +544,7 @@ tracker_xmp_new (const gchar *buffer,
 	data = g_new0 (TrackerXmpData, 1);
 
 	if (!parse_xmp (buffer, len, uri, data)) {
-		tracker_xmp_free (data, TRUE);
+		tracker_xmp_free (data);
 		return NULL;
 	}
 
@@ -562,51 +562,48 @@ tracker_xmp_new (const gchar *buffer,
  * Since: 0.9
  **/
 void
-tracker_xmp_free (TrackerXmpData *data,
-                  gboolean        free_members)
+tracker_xmp_free (TrackerXmpData *data)
 {
 	g_return_if_fail (data != NULL);
 
-	if (free_members) {
-		g_free (data->title);
-		g_free (data->rights);
-		g_free (data->creator);
-		g_free (data->description);
-		g_free (data->date);
-		g_free (data->keywords);
-		g_free (data->subject);
-		g_free (data->publisher);
-		g_free (data->contributor);
-		g_free (data->type);
-		g_free (data->format);
-		g_free (data->identifier);
-		g_free (data->source);
-		g_free (data->language);
-		g_free (data->relation);
-		g_free (data->coverage);
-		g_free (data->license);
-		g_free (data->pdf_title);
-		g_free (data->pdf_keywords);
-		g_free (data->title2);
-		g_free (data->time_original);
-		g_free (data->artist);
-		g_free (data->make);
-		g_free (data->model);
-		g_free (data->orientation);
-		g_free (data->flash);
-		g_free (data->metering_mode);
-		g_free (data->exposure_time);
-		g_free (data->fnumber);
-		g_free (data->focal_length);
-		g_free (data->iso_speed_ratings);
-		g_free (data->white_balance);
-		g_free (data->copyright);
-		g_free (data->rating);
-		g_free (data->address);
-		g_free (data->country);
-		g_free (data->state);
-		g_free (data->city);
-	}
+	g_free (data->title);
+	g_free (data->rights);
+	g_free (data->creator);
+	g_free (data->description);
+	g_free (data->date);
+	g_free (data->keywords);
+	g_free (data->subject);
+	g_free (data->publisher);
+	g_free (data->contributor);
+	g_free (data->type);
+	g_free (data->format);
+	g_free (data->identifier);
+	g_free (data->source);
+	g_free (data->language);
+	g_free (data->relation);
+	g_free (data->coverage);
+	g_free (data->license);
+	g_free (data->pdf_title);
+	g_free (data->pdf_keywords);
+	g_free (data->title2);
+	g_free (data->time_original);
+	g_free (data->artist);
+	g_free (data->make);
+	g_free (data->model);
+	g_free (data->orientation);
+	g_free (data->flash);
+	g_free (data->metering_mode);
+	g_free (data->exposure_time);
+	g_free (data->fnumber);
+	g_free (data->focal_length);
+	g_free (data->iso_speed_ratings);
+	g_free (data->white_balance);
+	g_free (data->copyright);
+	g_free (data->rating);
+	g_free (data->address);
+	g_free (data->country);
+	g_free (data->state);
+	g_free (data->city);
 
 	g_free (data);
 }
@@ -671,17 +668,14 @@ tracker_xmp_apply (TrackerSparqlBuilder *metadata,
 
 	if (data->keywords) {
 		insert_keywords (metadata, uri, data->keywords);
-		g_free (data->keywords);
 	}
 
 	if (data->subject) {
 		insert_keywords (metadata, uri, data->subject);
-		g_free (data->subject);
 	}
 
 	if (data->pdf_keywords) {
 		insert_keywords (metadata, uri, data->pdf_keywords);
-		g_free (data->pdf_keywords);
 	}
 
 	if (data->publisher) {
@@ -694,59 +688,50 @@ tracker_xmp_apply (TrackerSparqlBuilder *metadata,
 		tracker_sparql_builder_predicate (metadata, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (metadata, data->publisher);
 		tracker_sparql_builder_object_blank_close (metadata);
-		g_free (data->publisher);
 	}
 
 	if (data->type) {
 		tracker_sparql_builder_predicate (metadata, "dc:type");
 		tracker_sparql_builder_object_unvalidated (metadata, data->type);
-		g_free (data->type);
 	}
 
 	if (data->format) {
 		tracker_sparql_builder_predicate (metadata, "dc:format");
 		tracker_sparql_builder_object_unvalidated (metadata, data->format);
-		g_free (data->format);
 	}
 
 	if (data->identifier) {
 		tracker_sparql_builder_predicate (metadata, "dc:identifier");
 		tracker_sparql_builder_object_unvalidated (metadata, data->identifier);
-		g_free (data->identifier);
 	}
 
 	if (data->source) {
 		tracker_sparql_builder_predicate (metadata, "dc:source");
 		tracker_sparql_builder_object_unvalidated (metadata, data->source);
-		g_free (data->source);
 	}
 
 	if (data->language) {
 		tracker_sparql_builder_predicate (metadata, "dc:language");
 		tracker_sparql_builder_object_unvalidated (metadata, data->language);
-		g_free (data->language);
 	}
 
 	if (data->relation) {
 		tracker_sparql_builder_predicate (metadata, "dc:relation");
 		tracker_sparql_builder_object_unvalidated (metadata, data->relation);
-		g_free (data->relation);
 	}
 
 	if (data->coverage) {
 		tracker_sparql_builder_predicate (metadata, "dc:coverage");
 		tracker_sparql_builder_object_unvalidated (metadata, data->coverage);
-		g_free (data->coverage);
 	}
 
 	if (data->license) {
 		tracker_sparql_builder_predicate (metadata, "dc:license");
 		tracker_sparql_builder_object_unvalidated (metadata, data->license);
-		g_free (data->license);
 	}
 
 	if (data->make || data->model) {
-		gchar *final_camera = tracker_merge (" ", 2, data->make, data->model);
+		gchar *final_camera = tracker_merge_const (" ", 2, data->make, data->model);
 
 		tracker_sparql_builder_predicate (metadata, "nmm:camera");
 		tracker_sparql_builder_object_unvalidated (metadata, final_camera);
@@ -754,53 +739,48 @@ tracker_xmp_apply (TrackerSparqlBuilder *metadata,
 	}
 
 	if (data->title || data->title2 || data->pdf_title) {
-		gchar *final_title = tracker_coalesce (3, data->title, 
-		                                       data->title2,
-		                                       data->pdf_title);
+		const gchar *final_title = tracker_coalesce_strip (3, data->title,
+		                                                   data->title2,
+		                                                   data->pdf_title);
+
 		tracker_sparql_builder_predicate (metadata, "nie:title");
 		tracker_sparql_builder_object_unvalidated (metadata, final_title);
-		g_free (final_title);
 	}
 
 	if (data->orientation) {
 		tracker_sparql_builder_predicate (metadata, "nfo:orientation");
 		tracker_sparql_builder_object_unvalidated (metadata, data->orientation);
-		g_free (data->orientation);
 	}
-	
+
 	if (data->rights || data->copyright) {
-		gchar *final_rights = tracker_coalesce (2, data->copyright, data->rights);
+		const gchar *final_rights = tracker_coalesce_strip (2, data->copyright, data->rights);
+
 		tracker_sparql_builder_predicate (metadata, "nie:copyright");
 		tracker_sparql_builder_object_unvalidated (metadata, final_rights);
-		g_free (final_rights);
 	}
 
 	if (data->white_balance) {
 		tracker_sparql_builder_predicate (metadata, "nmm:whiteBalance");
 		tracker_sparql_builder_object_unvalidated (metadata, data->white_balance);
-		g_free (data->white_balance);
 	}
 
 	if (data->fnumber) {
 		tracker_sparql_builder_predicate (metadata, "nmm:fnumber");
 		tracker_sparql_builder_object_unvalidated (metadata, data->fnumber);
-		g_free (data->fnumber);
 	}
 
 	if (data->flash) {
 		tracker_sparql_builder_predicate (metadata, "nmm:flash");
 		tracker_sparql_builder_object_unvalidated (metadata, data->flash);
-		g_free (data->flash);
 	}
 
 	if (data->focal_length) {
 		tracker_sparql_builder_predicate (metadata, "nmm:focalLength");
 		tracker_sparql_builder_object_unvalidated (metadata, data->focal_length);
-		g_free (data->focal_length);
 	}
 
 	if (data->artist || data->contributor) {
-		gchar *final_artist = tracker_coalesce (2, data->artist, data->contributor);
+		const gchar *final_artist = tracker_coalesce_strip (2, data->artist, data->contributor);
 
 		tracker_sparql_builder_predicate (metadata, "nco:contributor");
 
@@ -811,38 +791,34 @@ tracker_xmp_apply (TrackerSparqlBuilder *metadata,
 		tracker_sparql_builder_predicate (metadata, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (metadata, final_artist);
 		tracker_sparql_builder_object_blank_close (metadata);
-		g_free (final_artist);
 	}
 
 	if (data->exposure_time) {
 		tracker_sparql_builder_predicate (metadata, "nmm:exposureTime");
 		tracker_sparql_builder_object_unvalidated (metadata, data->exposure_time);
-		g_free (data->exposure_time);
 	}
 
 	if (data->iso_speed_ratings) {
 		tracker_sparql_builder_predicate (metadata, "nmm:isoSpeed");
 		tracker_sparql_builder_object_unvalidated (metadata, data->iso_speed_ratings);
-		g_free (data->iso_speed_ratings);
 	}
 
 	if (data->date || data->time_original) {
-		gchar *final_date = tracker_coalesce (2, data->date, data->time_original);
+		const gchar *final_date = tracker_coalesce_strip (2, data->date,
+		                                                  data->time_original);
+
 		tracker_sparql_builder_predicate (metadata, "nie:contentCreated");
 		tracker_sparql_builder_object_unvalidated (metadata, final_date);
-		g_free (final_date);
 	}
 
 	if (data->description) {
 		tracker_sparql_builder_predicate (metadata, "nie:description");
 		tracker_sparql_builder_object_unvalidated (metadata, data->description);
-		g_free (data->description);
 	}
 
 	if (data->metering_mode) {
 		tracker_sparql_builder_predicate (metadata, "nmm:meteringMode");
 		tracker_sparql_builder_object_unvalidated (metadata, data->metering_mode);
-		g_free (data->metering_mode);
 	}
 
 	if (data->creator) {
@@ -855,7 +831,6 @@ tracker_xmp_apply (TrackerSparqlBuilder *metadata,
 		tracker_sparql_builder_predicate (metadata, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (metadata, data->creator);
 		tracker_sparql_builder_object_blank_close (metadata);
-		g_free (data->creator);
 	}
 
 	if (data->address || data->country || data->city) {
@@ -868,25 +843,21 @@ tracker_xmp_apply (TrackerSparqlBuilder *metadata,
 		if (data->address) {
 			tracker_sparql_builder_predicate (metadata, "mlo:address");
 			tracker_sparql_builder_object_unvalidated (metadata, data->address);
-			g_free (data->address);
 		}
 
 		if (data->state) {
 			tracker_sparql_builder_predicate (metadata, "mlo:state");
 			tracker_sparql_builder_object_unvalidated (metadata, data->state);
-			g_free (data->state);
 		}
 
 		if (data->city) {
 			tracker_sparql_builder_predicate (metadata, "mlo:city");
 			tracker_sparql_builder_object_unvalidated (metadata, data->city);
-			g_free (data->city);
 		}
 
 		if (data->country) {
 			tracker_sparql_builder_predicate (metadata, "mlo:country");
 			tracker_sparql_builder_object_unvalidated (metadata, data->country);
-			g_free (data->country);
 		}
 	
 		tracker_sparql_builder_object_blank_close (metadata);
diff --git a/src/libtracker-extract/tracker-xmp.h b/src/libtracker-extract/tracker-xmp.h
index 7382173..0661aec 100644
--- a/src/libtracker-extract/tracker-xmp.h
+++ b/src/libtracker-extract/tracker-xmp.h
@@ -86,23 +86,19 @@ typedef struct {
 
 #ifndef TRACKER_DISABLE_DEPRECATED
 
-gboolean tracker_xmp_read  (const gchar          *buffer,
-                            size_t                len,
-                            const gchar          *uri,
-                            TrackerXmpData       *data) G_GNUC_DEPRECATED;
-
+gboolean         tracker_xmp_read  (const gchar          *buffer,
+                                    size_t                len,
+                                    const gchar          *uri,
+                                    TrackerXmpData       *data) G_GNUC_DEPRECATED;
 #endif /* TRACKER_DISABLE_DEPRECATED */
 
-TrackerXmpData * tracker_xmp_new (const gchar *buffer,
-                                  gsize        len,
-                                  const gchar *uri);
-
-void tracker_xmp_free (TrackerXmpData *data,
-                       gboolean        free_members);
-
-gboolean tracker_xmp_apply (TrackerSparqlBuilder *metadata,
-                            const gchar          *uri,
-                            TrackerXmpData       *data);
+TrackerXmpData * tracker_xmp_new   (const gchar          *buffer,
+                                    gsize                 len,
+                                    const gchar          *uri);
+void             tracker_xmp_free  (TrackerXmpData       *data);
+gboolean         tracker_xmp_apply (TrackerSparqlBuilder *metadata,
+                                    const gchar          *uri,
+                                    TrackerXmpData       *data);
 
 G_END_DECLS
 
diff --git a/src/tracker-extract/tracker-extract-flac.c b/src/tracker-extract/tracker-extract-flac.c
index b7b3852..ca6cfe3 100644
--- a/src/tracker-extract/tracker-extract-flac.c
+++ b/src/tracker-extract/tracker-extract-flac.c
@@ -170,7 +170,8 @@ extract_flac (const gchar          *uri,
 	FLAC__StreamMetadata *stream = NULL, *vorbis, *picture;
 	FLAC__bool success;
 	FlacData fd = { 0 };
-	gchar *filename, *creator, *artist_uri = NULL, *album_uri = NULL;
+	gchar *filename, *artist_uri = NULL, *album_uri = NULL;
+	const gchar *creator;
 	goffset size;
 
 	filename = g_filename_from_uri (uri, NULL, NULL);
@@ -187,37 +188,37 @@ extract_flac (const gchar          *uri,
 	g_free (filename);
 
 	if (!success) {
-			FLAC__metadata_simple_iterator_delete (iter);
-			return;
+		FLAC__metadata_simple_iterator_delete (iter);
+		return;
 	}
 
 	while (!FLAC__metadata_simple_iterator_is_last (iter)) {
-			switch (FLAC__metadata_simple_iterator_get_block_type (iter)) {
-			case FLAC__METADATA_TYPE_STREAMINFO:
-					stream = FLAC__metadata_simple_iterator_get_block (iter);
-					break;
-
-			case FLAC__METADATA_TYPE_VORBIS_COMMENT:
-					vorbis = FLAC__metadata_simple_iterator_get_block (iter);
-					parse_vorbis_comments (&(vorbis->data.vorbis_comment), &fd);
-					FLAC__metadata_object_delete (vorbis);
-					break;
-
-			case FLAC__METADATA_TYPE_PICTURE:
-					picture = FLAC__metadata_simple_iterator_get_block (iter);
-					/* Deal with picture */
-					FLAC__metadata_object_delete (picture);
-					break;
-
-			default:
-					break;
-			}
+		switch (FLAC__metadata_simple_iterator_get_block_type (iter)) {
+		case FLAC__METADATA_TYPE_STREAMINFO:
+			stream = FLAC__metadata_simple_iterator_get_block (iter);
+			break;
+
+		case FLAC__METADATA_TYPE_VORBIS_COMMENT:
+			vorbis = FLAC__metadata_simple_iterator_get_block (iter);
+			parse_vorbis_comments (&(vorbis->data.vorbis_comment), &fd);
+			FLAC__metadata_object_delete (vorbis);
+			break;
+
+		case FLAC__METADATA_TYPE_PICTURE:
+			picture = FLAC__metadata_simple_iterator_get_block (iter);
+			/* Deal with picture */
+			FLAC__metadata_object_delete (picture);
+			break;
+
+		default:
+			break;
+		}
 
-			FLAC__metadata_simple_iterator_next (iter);
+		FLAC__metadata_simple_iterator_next (iter);
 	}
 
-	creator = tracker_coalesce (3, fd.artist, fd.albumartist,
-	                            fd.performer);
+	creator = tracker_coalesce_strip (3, fd.artist, fd.albumartist,
+	                                  fd.performer);
 
 	if (creator) {
 		artist_uri = tracker_uri_printf_escaped ("urn:artist:%s", creator);
@@ -229,8 +230,6 @@ extract_flac (const gchar          *uri,
 		tracker_sparql_builder_predicate (preupdate, "nmm:artistName");
 		tracker_sparql_builder_object_unvalidated (preupdate, creator);
 		tracker_sparql_builder_insert_close (preupdate);
-
-		g_free (creator);
 	}
 
 	if (fd.album) {
@@ -371,6 +370,9 @@ extract_flac (const gchar          *uri,
 		                                        stream->data.stream_info.sample_rate);
 	}
 
+	g_free (fd.artist);
+	g_free (fd.albumartist);
+	g_free (fd.performer);
 	g_free (fd.title);
 	g_free (fd.trackcount);
 	g_free (fd.tracknumber);
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 0618785..3ed895c 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -462,6 +462,7 @@ extract_metadata (MetadataExtractor      *extractor,
                   gchar                 **album,
                   gchar                 **scount)
 {
+	const gchar *temp;
 	gchar *s;
 	gboolean ret;
 	gint count;
@@ -499,22 +500,25 @@ extract_metadata (MetadataExtractor      *extractor,
 			gst_tag_list_get_string (extractor->tagcache, GST_TAG_PERFORMER, &performer);
 			gst_tag_list_get_string (extractor->tagcache, GST_TAG_ARTIST, &artist_local);
 
-			s = tracker_coalesce (2, performer, artist_local);
+			temp = tracker_coalesce_strip (2, performer, artist_local);
 
-			if (s) {
-				performer_uri = tracker_uri_printf_escaped ("urn:artist:%s", s);
+			if (temp) {
+				performer_uri = tracker_uri_printf_escaped ("urn:artist:%s", temp);
 
 				tracker_sparql_builder_insert_open (preupdate, NULL);
 				tracker_sparql_builder_subject_iri (preupdate, performer_uri);
 				tracker_sparql_builder_predicate (preupdate, "a");
 				tracker_sparql_builder_object (preupdate, "nmm:Artist");
 				tracker_sparql_builder_predicate (preupdate, "nmm:artistName");
-				tracker_sparql_builder_object_unvalidated (preupdate, s);
+				tracker_sparql_builder_object_unvalidated (preupdate, temp);
 				tracker_sparql_builder_insert_close (preupdate);
 
-				*artist = s;
+				*artist = g_strdup (temp);
 			}
 
+			g_free (performer);
+			g_free (artist_local);
+
 			s = NULL;
 			gst_tag_list_get_string (extractor->tagcache, GST_TAG_COMPOSER, &s);
 
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index 2debe8e..421d79e 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -53,25 +53,25 @@
 
 typedef struct {
 	gchar *camera;
-	gchar *title;
-	gchar *orientation;
-	gchar *copyright;
-	gchar *white_balance;
-	gchar *fnumber;
-	gchar *flash;
-	gchar *focal_length;
-	gchar *artist;
-	gchar *exposure_time;
-	gchar *iso_speed_ratings;
-	gchar *date;
-	gchar *description;
-	gchar *metering_mode;
-	gchar *creator;
-	gchar *comment;
-	gchar *city;
-	gchar *state;
-	gchar *address;
-	gchar *country; 
+	const gchar *title;
+	const gchar *orientation;
+	const gchar *copyright;
+	const gchar *white_balance;
+	const gchar *fnumber;
+	const gchar *flash;
+	const gchar *focal_length;
+	const gchar *artist;
+	const gchar *exposure_time;
+	const gchar *iso_speed_ratings;
+	const gchar *date;
+	const gchar *description;
+	const gchar *metering_mode;
+	const gchar *creator;
+	const gchar *comment;
+	const gchar *city;
+	const gchar *state;
+	const gchar *address;
+	const gchar *country; 
 } MergeData;
 
 static void extract_jpeg (const gchar          *filename,
@@ -218,15 +218,15 @@ extract_jpeg (const gchar          *uri,
 
 #ifdef HAVE_LIBEXIF
 			if (strncmp (EXIF_NAMESPACE, str, EXIF_NAMESPACE_LENGTH) == 0) {
-                                ed = tracker_exif_new ((guchar *) marker->data, len, uri);
+				ed = tracker_exif_new ((guchar *) marker->data, len, uri);
 			}
 #endif /* HAVE_LIBEXIF */
 
 #ifdef HAVE_EXEMPI
 			if (strncmp (XMP_NAMESPACE, str, XMP_NAMESPACE_LENGTH) == 0) {
-                                xd = tracker_xmp_new (str + XMP_NAMESPACE_LENGTH,
-                                                      len - XMP_NAMESPACE_LENGTH,
-                                                      uri);
+				xd = tracker_xmp_new (str + XMP_NAMESPACE_LENGTH,
+				                      len - XMP_NAMESPACE_LENGTH,
+				                      uri);
 			}
 #endif /* HAVE_EXEMPI */
 
@@ -269,58 +269,48 @@ extract_jpeg (const gchar          *uri,
 	/* Don't merge if the make is in the model */
 	if ((xd->make == NULL || xd->model == NULL) ||
 	    (xd->make && xd->model && strstr (xd->model, xd->make) == NULL)) {
-		md.camera = tracker_merge (" ", 2, xd->make, xd->model);
+		md.camera = tracker_merge_const (" ", 2, xd->make, xd->model);
 	} else {
 		md.camera = g_strdup (xd->model);
-		g_free (xd->model);
-		g_free (xd->make);
 	}
 
 	if (!md.camera) {
 		if ((ed->make == NULL || ed->model == NULL) ||
 		    (ed->make && ed->model && strstr (ed->model, ed->make) == NULL)) {
-			md.camera = tracker_merge (" ", 2, ed->make, ed->model);
+			md.camera = tracker_merge_const (" ", 2, ed->make, ed->model);
 		} else {
 			md.camera = g_strdup (ed->model);
-			g_free (ed->model);
-			g_free (ed->make);
 		}
-	} else {
-		g_free (ed->model);
-		g_free (ed->make);
-	}
-
-	md.title = tracker_coalesce (4, xd->title, ed->document_name, xd->title2, xd->pdf_title);
-	md.orientation = tracker_coalesce (3, xd->orientation, ed->orientation, id->image_orientation);
-	md.copyright = tracker_coalesce (4, xd->copyright, xd->rights, ed->copyright, id->copyright_notice);
-	md.white_balance = tracker_coalesce (2, xd->white_balance, ed->white_balance);
-	md.fnumber = tracker_coalesce (2, xd->fnumber, ed->fnumber);
-	md.flash = tracker_coalesce (2, xd->flash, ed->flash);
-	md.focal_length =  tracker_coalesce (2, xd->focal_length, ed->focal_length);
-	md.artist = tracker_coalesce (3, xd->artist, ed->artist, xd->contributor);
-	md.exposure_time = tracker_coalesce (2, xd->exposure_time, ed->exposure_time);
-	md.iso_speed_ratings = tracker_coalesce (2, xd->iso_speed_ratings, ed->iso_speed_ratings);
-	md.date = tracker_coalesce (5, xd->date, xd->time_original, ed->time, id->date_created, ed->time_original);
-	md.description = tracker_coalesce (2, xd->description, ed->description);
-	md.metering_mode = tracker_coalesce (2, xd->metering_mode, ed->metering_mode);
-	md.city = tracker_coalesce (2, xd->city, id->city);
-	md.state = tracker_coalesce (2, xd->state, id->state);
-	md.address = tracker_coalesce (2, xd->address, id->sublocation);
-	md.country = tracker_coalesce (2, xd->country, id->country_name);
-	md.creator = tracker_coalesce (3, xd->creator, id->byline, id->credit);
-	md.comment = tracker_coalesce (2, comment, ed->user_comment);
+	}
+
+	md.title = tracker_coalesce_strip (4, xd->title, ed->document_name, xd->title2, xd->pdf_title);
+	md.orientation = tracker_coalesce_strip (3, xd->orientation, ed->orientation, id->image_orientation);
+	md.copyright = tracker_coalesce_strip (4, xd->copyright, xd->rights, ed->copyright, id->copyright_notice);
+	md.white_balance = tracker_coalesce_strip (2, xd->white_balance, ed->white_balance);
+	md.fnumber = tracker_coalesce_strip (2, xd->fnumber, ed->fnumber);
+	md.flash = tracker_coalesce_strip (2, xd->flash, ed->flash);
+	md.focal_length =  tracker_coalesce_strip (2, xd->focal_length, ed->focal_length);
+	md.artist = tracker_coalesce_strip (3, xd->artist, ed->artist, xd->contributor);
+	md.exposure_time = tracker_coalesce_strip (2, xd->exposure_time, ed->exposure_time);
+	md.iso_speed_ratings = tracker_coalesce_strip (2, xd->iso_speed_ratings, ed->iso_speed_ratings);
+	md.date = tracker_coalesce_strip (5, xd->date, xd->time_original, ed->time, id->date_created, ed->time_original);
+	md.description = tracker_coalesce_strip (2, xd->description, ed->description);
+	md.metering_mode = tracker_coalesce_strip (2, xd->metering_mode, ed->metering_mode);
+	md.city = tracker_coalesce_strip (2, xd->city, id->city);
+	md.state = tracker_coalesce_strip (2, xd->state, id->state);
+	md.address = tracker_coalesce_strip (2, xd->address, id->sublocation);
+	md.country = tracker_coalesce_strip (2, xd->country, id->country_name);
+	md.creator = tracker_coalesce_strip (3, xd->creator, id->byline, id->credit);
+	md.comment = tracker_coalesce_strip (2, comment, ed->user_comment);
 
 	/* Prioritize on native dimention in all cases */
 	tracker_sparql_builder_predicate (metadata, "nfo:width");
 	tracker_sparql_builder_object_int64 (metadata, cinfo.image_width);
-	g_free (ed->x_dimension);
 
-	/* TODO: add ontology and store this */
-	g_free (ed->software);
+	/* TODO: add ontology and store ed->software */
 
 	tracker_sparql_builder_predicate (metadata, "nfo:height");
 	tracker_sparql_builder_object_int64 (metadata, cinfo.image_height);
-	g_free (ed->y_dimension);
 
 	if (id->contact) {
 		gchar *uri = tracker_uri_printf_escaped ("urn:contact:%s", id->contact);
@@ -332,7 +322,6 @@ extract_jpeg (const gchar          *uri,
 		tracker_sparql_builder_predicate (preupdate, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (preupdate, id->contact);
 		tracker_sparql_builder_insert_close (preupdate);
-		g_free (id->contact);
 
 		tracker_sparql_builder_predicate (metadata, "nco:representative");
 		tracker_sparql_builder_object_iri (metadata, uri);
@@ -341,17 +330,14 @@ extract_jpeg (const gchar          *uri,
 
 	if (xd->keywords) {
 		insert_keywords (metadata, xd->keywords);
-		g_free (xd->keywords);
 	}
 
 	if (xd->pdf_keywords) {
 		insert_keywords (metadata, xd->pdf_keywords);
-		g_free (xd->pdf_keywords);
 	}
 
 	if (xd->subject) {
 		insert_keywords (metadata, xd->subject);
-		g_free (xd->subject);
 	}
 
 	if (xd->publisher) {
@@ -364,7 +350,6 @@ extract_jpeg (const gchar          *uri,
 		tracker_sparql_builder_predicate (preupdate, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (preupdate, xd->publisher);
 		tracker_sparql_builder_insert_close (preupdate);
-		g_free (xd->publisher);
 
 		tracker_sparql_builder_predicate (metadata, "nco:publisher");
 		tracker_sparql_builder_object_iri (metadata, uri);
@@ -374,90 +359,75 @@ extract_jpeg (const gchar          *uri,
 	if (xd->type) {
 		tracker_sparql_builder_predicate (metadata, "dc:type");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->type);
-		g_free (xd->type);
 	}
 
 	if (xd->rating) {
 		tracker_sparql_builder_predicate (metadata, "nao:numericRating");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->rating);
-		g_free (xd->rating);
 	}
 
 	if (xd->format) {
 		tracker_sparql_builder_predicate (metadata, "dc:format");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->format);
-		g_free (xd->format);
 	}
 
 	if (xd->identifier) {
 		tracker_sparql_builder_predicate (metadata, "dc:indentifier");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->identifier);
-		g_free (xd->identifier);
 	}
 
 	if (xd->source) {
 		tracker_sparql_builder_predicate (metadata, "dc:source");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->source);
-		g_free (xd->source);
 	}
 
 	if (xd->language) {
 		tracker_sparql_builder_predicate (metadata, "dc:language");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->language);
-		g_free (xd->language);
 	}
 
 	if (xd->relation) {
 		tracker_sparql_builder_predicate (metadata, "dc:relation");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->relation);
-		g_free (xd->relation);
 	}
 
 	if (xd->coverage) {
 		tracker_sparql_builder_predicate (metadata, "dc:coverage");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->coverage);
-		g_free (xd->coverage);
 	}
 
 	if (xd->license) {
 		tracker_sparql_builder_predicate (metadata, "nie:license");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->license);
-		g_free (xd->license);
 	}
 
 	if (id->keywords) {
 		insert_keywords (metadata, id->keywords);
-		g_free (id->keywords);
 	}
 
 	if (md.camera) {
 		tracker_sparql_builder_predicate (metadata, "nmm:camera");
 		tracker_sparql_builder_object_unvalidated (metadata, md.camera);
-		g_free (md.camera);
 	}
 
 	if (md.title) {
 		tracker_sparql_builder_predicate (metadata, "nie:title");
 		tracker_sparql_builder_object_unvalidated (metadata, md.title);
-		g_free (md.title);
 	}
 
 	if (md.orientation) {
 		tracker_sparql_builder_predicate (metadata, "nfo:orientation");
 		tracker_sparql_builder_object (metadata, md.orientation);
-		g_free (md.orientation);
 	}
 
 	if (md.copyright) {
 		tracker_sparql_builder_predicate (metadata, "nie:copyright");
 		tracker_sparql_builder_object_unvalidated (metadata, md.copyright);
-		g_free (md.copyright);
 	}
 
 	if (md.white_balance) {
 		tracker_sparql_builder_predicate (metadata, "nmm:whiteBalance");
 		tracker_sparql_builder_object (metadata, md.white_balance);
-		g_free (md.white_balance);
 	}
 
 	if (md.fnumber) {
@@ -466,13 +436,11 @@ extract_jpeg (const gchar          *uri,
 		value = g_strtod (md.fnumber, NULL);
 		tracker_sparql_builder_predicate (metadata, "nmm:fnumber");
 		tracker_sparql_builder_object_double (metadata, value);
-		g_free (md.fnumber);
 	}
 
 	if (md.flash) {
 		tracker_sparql_builder_predicate (metadata, "nmm:flash");
 		tracker_sparql_builder_object (metadata, md.flash);
-		g_free (md.flash);
 	}
 
 	if (md.focal_length) {
@@ -481,7 +449,6 @@ extract_jpeg (const gchar          *uri,
 		value = g_strtod (md.focal_length, NULL);
 		tracker_sparql_builder_predicate (metadata, "nmm:focalLength");
 		tracker_sparql_builder_object_double (metadata, value);
-		g_free (md.focal_length);
 	}
 
 	if (md.artist) {
@@ -494,7 +461,6 @@ extract_jpeg (const gchar          *uri,
 		tracker_sparql_builder_predicate (preupdate, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (preupdate, md.artist);
 		tracker_sparql_builder_insert_close (preupdate);
-		g_free (md.artist);
 
 		tracker_sparql_builder_predicate (metadata, "nco:contributor");
 		tracker_sparql_builder_object_iri (metadata, uri);
@@ -507,7 +473,6 @@ extract_jpeg (const gchar          *uri,
 		value = g_strtod (md.exposure_time, NULL);
 		tracker_sparql_builder_predicate (metadata, "nmm:exposureTime");
 		tracker_sparql_builder_object_double (metadata, value);
-		g_free (md.exposure_time);
 	}
 
 	if (md.iso_speed_ratings) {
@@ -516,25 +481,21 @@ extract_jpeg (const gchar          *uri,
 		value = g_strtod (md.iso_speed_ratings, NULL);
 		tracker_sparql_builder_predicate (metadata, "nmm:isoSpeed");
 		tracker_sparql_builder_object_double (metadata, value);
-		g_free (md.iso_speed_ratings);
 	}
 
 	if (md.date) {
 		tracker_sparql_builder_predicate (metadata, "nie:contentCreated");
 		tracker_sparql_builder_object_unvalidated (metadata, md.date);
-		g_free (md.date);
 	}
 
 	if (md.description) {
 		tracker_sparql_builder_predicate (metadata, "nie:description");
 		tracker_sparql_builder_object_unvalidated (metadata, md.description);
-		g_free (md.description);
 	}
 
 	if (md.metering_mode) {
 		tracker_sparql_builder_predicate (metadata, "nmm:meteringMode");
 		tracker_sparql_builder_object (metadata, md.metering_mode);
-		g_free (md.metering_mode);
 	}
 
 	if (md.creator) {
@@ -547,7 +508,6 @@ extract_jpeg (const gchar          *uri,
 		tracker_sparql_builder_predicate (preupdate, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (preupdate, md.creator);
 		tracker_sparql_builder_insert_close (preupdate);
-		g_free (md.creator);
 
 		/* NOTE: We only have affiliation with
 		 * nco:PersonContact and we are using
@@ -577,12 +537,9 @@ extract_jpeg (const gchar          *uri,
 		g_free (uri);
 	}
 
-	g_free (id->byline_title);
-
 	if (md.comment) {
 		tracker_sparql_builder_predicate (metadata, "nie:comment");
 		tracker_sparql_builder_object_unvalidated (metadata, md.comment);
-		g_free (md.comment);
 	}
 
 	if (md.city || md.state || md.address || md.country) {
@@ -595,25 +552,21 @@ extract_jpeg (const gchar          *uri,
 		if (md.address) {
 			tracker_sparql_builder_predicate (metadata, "mlo:address");
 			tracker_sparql_builder_object_unvalidated (metadata, md.address);
-			g_free (md.address);
 		}
 	
 		if (md.state) {
 			tracker_sparql_builder_predicate (metadata, "mlo:state");
 			tracker_sparql_builder_object_unvalidated (metadata, md.state);
-			g_free (md.state);
 		}
 	
 		if (md.city) {
 			tracker_sparql_builder_predicate (metadata, "mlo:city");
 			tracker_sparql_builder_object_unvalidated (metadata, md.city);
-			g_free (md.city);
 		}
 	
 		if (md.country) {
 			tracker_sparql_builder_predicate (metadata, "mlo:country");
 			tracker_sparql_builder_object_unvalidated (metadata, md.country);
-			g_free (md.country);
 		}
 		
 		tracker_sparql_builder_object_blank_close (metadata);
@@ -625,7 +578,6 @@ extract_jpeg (const gchar          *uri,
 		value = g_strtod (ed->x_resolution, NULL);
 		tracker_sparql_builder_predicate (metadata, "nfo:horizontalResolution");
 		tracker_sparql_builder_object_int64 (metadata, (gint64) value);
-		g_free (ed->x_resolution);
 	}
 
 	if (ed->y_resolution) {
@@ -634,14 +586,16 @@ extract_jpeg (const gchar          *uri,
 		value = g_strtod (ed->y_resolution, NULL);
 		tracker_sparql_builder_predicate (metadata, "nfo:verticalResolution");
 		tracker_sparql_builder_object_int64 (metadata, (gint64) value);
-		g_free (ed->y_resolution);
 	}
 
 	jpeg_destroy_decompress (&cinfo);
 
-        tracker_exif_free (ed, FALSE);
-        tracker_xmp_free (xd, FALSE);
-        tracker_iptc_free (id, FALSE);
+	g_free (md.camera);
+
+	tracker_exif_free (ed);
+	tracker_xmp_free (xd);
+	tracker_iptc_free (id);
+
 fail:
 	tracker_file_close (f, FALSE);
 }
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index 6dcd2c9..5f84a12 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -149,20 +149,20 @@ typedef struct {
 
 	guint32 duration;
 
-	gchar *title;
-	gchar *performer;
+	const gchar *title;
+	const gchar *performer;
 	gchar *performer_uri;
-	gchar *lyricist;
+	const gchar *lyricist;
 	gchar *lyricist_uri;
-	gchar *album;
+	const gchar *album;
 	gchar *album_uri;
-	gchar *genre;
-	gchar *text;
-	gchar *recording_time;
-	gchar *copyright;
-	gchar *publisher;
-	gchar *comment;
-	gchar *composer;
+	const gchar *genre;
+	const gchar *text;
+	const gchar *recording_time;
+	const gchar *copyright;
+	const gchar *publisher;
+	const gchar *comment;
+	const gchar *composer;
 	gchar *composer_uri;
 	gint track_number;
 	gint track_count;
@@ -436,6 +436,40 @@ static TrackerExtractData extract_data[] = {
 	{ NULL, NULL }
 };
 
+
+
+static void
+id3tag_free (id3tag *tags)
+{
+	g_free (tags->title);
+	g_free (tags->artist);
+	g_free (tags->album);
+	g_free (tags->recording_time);
+	g_free (tags->comment);
+	g_free (tags->genre);
+	g_free (tags->encoding);
+}
+
+static void
+id3v2tag_free (id3v2tag *tags)
+{
+	g_free (tags->album);
+	g_free (tags->comment);
+	g_free (tags->content_type);
+	g_free (tags->copyright);
+	g_free (tags->performer1);
+	g_free (tags->performer2);
+	g_free (tags->composer);
+	g_free (tags->publisher);
+	g_free (tags->recording_time);
+	g_free (tags->release_time);
+	g_free (tags->text);
+	g_free (tags->toly);
+	g_free (tags->title1);
+	g_free (tags->title2);
+	g_free (tags->title3);
+}
+
 static char *
 read_id3v1_buffer (int     fd,
                    goffset size)
@@ -1879,9 +1913,7 @@ extract_mp3 (const gchar          *uri,
 	goffset size;
 	goffset  buffer_size;
 	goffset audio_offset;
-	MP3Data md;
-
-	memset (&md, 0, sizeof (MP3Data));
+	MP3Data md = { 0 };
 
 	filename = g_filename_from_uri (uri, NULL, NULL);
 
@@ -1943,37 +1975,64 @@ extract_mp3 (const gchar          *uri,
 	/* Get other embedded tags */
 	audio_offset = parse_id3v2 (buffer, buffer_size, &md.id3v1, uri, metadata, &md);
 
-	md.title = tracker_coalesce (4, md.id3v24.title2, md.id3v23.title2, md.id3v22.title2, md.id3v1.title);
-	md.lyricist = tracker_coalesce (4, md.id3v24.text, md.id3v23.toly, md.id3v23.text, md.id3v22.text);
-
-	md.composer = tracker_coalesce (3,
-	                                md.id3v24.composer,
-	                                md.id3v23.composer,
-	                                md.id3v22.composer);
-
-	md.performer = tracker_coalesce (7,
-	                                 md.id3v24.performer1, md.id3v24.performer2,
-	                                 md.id3v23.performer1, md.id3v23.performer2,
-	                                 md.id3v22.performer1, md.id3v22.performer2,
-	                                 md.id3v1.artist);
-	md.album = tracker_coalesce (4, md.id3v24.album, md.id3v23.album, md.id3v22.album, md.id3v1.album);
-	md.genre = tracker_coalesce (7,
-	                             md.id3v24.content_type, md.id3v24.title1,
-	                             md.id3v23.content_type, md.id3v23.title1,
-	                             md.id3v22.content_type, md.id3v22.title1,
-	                             md.id3v1.genre);
-	md.recording_time = tracker_coalesce (7,
-	                                      md.id3v24.recording_time, md.id3v24.release_time,
-	                                      md.id3v23.recording_time, md.id3v23.release_time,
-	                                      md.id3v22.recording_time, md.id3v22.release_time,
-	                                      md.id3v1.recording_time);
-	md.publisher = tracker_coalesce (3, md.id3v24.publisher, md.id3v23.publisher, md.id3v22.publisher);
-	md.copyright = tracker_coalesce (3, md.id3v24.copyright, md.id3v23.copyright, md.id3v22.copyright);
-	md.comment = tracker_coalesce (7,
-	                               md.id3v24.title3, md.id3v24.comment,
-	                               md.id3v23.title3, md.id3v23.comment,
-	                               md.id3v22.title3, md.id3v22.comment,
-	                               md.id3v1.comment);
+	md.title = tracker_coalesce_strip (4, md.id3v24.title2,
+	                                   md.id3v23.title2,
+	                                   md.id3v22.title2,
+	                                   md.id3v1.title);
+
+	md.lyricist = tracker_coalesce_strip (4, md.id3v24.text,
+	                                      md.id3v23.toly,
+	                                      md.id3v23.text,
+	                                      md.id3v22.text);
+
+	md.composer = tracker_coalesce_strip (3, md.id3v24.composer,
+	                                      md.id3v23.composer,
+	                                      md.id3v22.composer);
+
+	md.performer = tracker_coalesce_strip (7, md.id3v24.performer1,
+	                                       md.id3v24.performer2,
+	                                       md.id3v23.performer1,
+	                                       md.id3v23.performer2,
+	                                       md.id3v22.performer1,
+	                                       md.id3v22.performer2,
+	                                       md.id3v1.artist);
+
+	md.album = tracker_coalesce_strip (4, md.id3v24.album,
+	                                   md.id3v23.album,
+	                                   md.id3v22.album,
+	                                   md.id3v1.album);
+
+	md.genre = tracker_coalesce_strip (7, md.id3v24.content_type,
+	                                   md.id3v24.title1,
+	                                   md.id3v23.content_type,
+	                                   md.id3v23.title1,
+	                                   md.id3v22.content_type,
+	                                   md.id3v22.title1,
+	                                   md.id3v1.genre);
+
+	md.recording_time = tracker_coalesce_strip (7, md.id3v24.recording_time,
+	                                            md.id3v24.release_time,
+	                                            md.id3v23.recording_time,
+	                                            md.id3v23.release_time,
+	                                            md.id3v22.recording_time,
+	                                            md.id3v22.release_time,
+	                                            md.id3v1.recording_time);
+
+	md.publisher = tracker_coalesce_strip (3, md.id3v24.publisher,
+	                                       md.id3v23.publisher,
+	                                       md.id3v22.publisher);
+
+	md.copyright = tracker_coalesce_strip (3, md.id3v24.copyright,
+	                                       md.id3v23.copyright,
+	                                       md.id3v22.copyright);
+
+	md.comment = tracker_coalesce_strip (7, md.id3v24.title3,
+	                                     md.id3v24.comment,
+	                                     md.id3v23.title3,
+	                                     md.id3v23.comment,
+	                                     md.id3v22.title3,
+	                                     md.id3v22.comment,
+	                                     md.id3v1.comment);
 
 	if (md.id3v24.track_number != 0) {
 		md.track_number = md.id3v24.track_number;
@@ -2005,7 +2064,6 @@ extract_mp3 (const gchar          *uri,
 		tracker_sparql_builder_object_unvalidated (preupdate, md.performer);
 
 		tracker_sparql_builder_insert_close (preupdate);
-		/* do not delete artist, needed by albumart */
 	}
 
 	if (md.composer) {
@@ -2032,7 +2090,6 @@ extract_mp3 (const gchar          *uri,
 		tracker_sparql_builder_predicate (preupdate, "nmm:artistName");
 		tracker_sparql_builder_object_unvalidated (preupdate, md.lyricist);
 		tracker_sparql_builder_insert_close (preupdate);
-		g_free (md.lyricist);
 	}
 
 	if (md.album) {
@@ -2077,7 +2134,6 @@ extract_mp3 (const gchar          *uri,
 	if (md.title) {
 		tracker_sparql_builder_predicate (metadata, "nie:title");
 		tracker_sparql_builder_object_unvalidated (metadata, md.title);
-		/* do not delete title, needed by albumart */
 	}
 
 
@@ -2108,25 +2164,21 @@ extract_mp3 (const gchar          *uri,
 	if (md.recording_time) {
 		tracker_sparql_builder_predicate (metadata, "nie:contentCreated");
 		tracker_sparql_builder_object_unvalidated (metadata, md.recording_time);
-		g_free (md.recording_time);
 	}
 
 	if (md.genre) {
 		tracker_sparql_builder_predicate (metadata, "nfo:genre");
 		tracker_sparql_builder_object_unvalidated (metadata, md.genre);
-		g_free (md.genre);
 	}
 
 	if (md.copyright) {
 		tracker_sparql_builder_predicate (metadata, "nie:copyright");
 		tracker_sparql_builder_object_unvalidated (metadata, md.copyright);
-		g_free (md.copyright);
 	}
 
 	if (md.comment) {
 		tracker_sparql_builder_predicate (metadata, "nie:comment");
 		tracker_sparql_builder_object_unvalidated (metadata, md.comment);
-		g_free (md.comment);
 	}
 
 	if (md.publisher) {
@@ -2137,7 +2189,6 @@ extract_mp3 (const gchar          *uri,
 		tracker_sparql_builder_predicate (metadata, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (metadata, md.publisher);
 		tracker_sparql_builder_object_blank_close (metadata);
-		g_free (md.publisher);
 	}
 
 	if (md.track_number > 0) {
@@ -2155,14 +2206,10 @@ extract_mp3 (const gchar          *uri,
 	                          md.album,
 	                          filename);
 
-	g_free (md.performer);
-	g_free (md.composer);
-	g_free (md.album);
-	g_free (md.title);
-	g_free (md.albumart_data);
-	g_free (md.albumart_mime);
-
-	g_free (md.id3v1.encoding);
+	id3v2tag_free (&md.id3v22);
+	id3v2tag_free (&md.id3v23);
+	id3v2tag_free (&md.id3v24);
+	id3tag_free (&md.id3v1);
 
 #ifndef G_OS_WIN32
 	munmap (buffer, buffer_size);
diff --git a/src/tracker-extract/tracker-extract-pdf.c b/src/tracker-extract/tracker-extract-pdf.c
index 3706fde..5cd64f6 100644
--- a/src/tracker-extract/tracker-extract-pdf.c
+++ b/src/tracker-extract/tracker-extract-pdf.c
@@ -55,129 +55,129 @@ static void
 read_toc (PopplerIndexIter  *index,
           GString          **toc)
 {
-        if (!index) {
-	        return;
-        }
+	if (!index) {
+		return;
+	}
 
-        if (!*toc) {
-	        *toc = g_string_new ("");
-        }
+	if (!*toc) {
+		*toc = g_string_new ("");
+	}
 
-        do {
-                PopplerAction *action;
-                PopplerIndexIter *iter;
+	do {
+		PopplerAction *action;
+		PopplerIndexIter *iter;
 
-                action = poppler_index_iter_get_action (index);
+		action = poppler_index_iter_get_action (index);
 
-                if (!action) {
-                        continue;
-                }
+		if (!action) {
+			continue;
+		}
 
-                switch (action->type) {
-                case POPPLER_ACTION_GOTO_DEST: {
-                        PopplerActionGotoDest *ag = (PopplerActionGotoDest*) action;
-                        PopplerDest *agd = ag->dest;
+		switch (action->type) {
+			case POPPLER_ACTION_GOTO_DEST: {
+				PopplerActionGotoDest *ag = (PopplerActionGotoDest*) action;
+				PopplerDest *agd = ag->dest;
 
-                        if (!tracker_is_empty_string (ag->title)) {
-	                        g_string_append_printf (*toc, "%s ", ag->title);
-                        }
+				if (!tracker_is_empty_string (ag->title)) {
+					g_string_append_printf (*toc, "%s ", ag->title);
+				}
 
-                        if (!tracker_is_empty_string (agd->named_dest)) {
-	                        g_string_append_printf (*toc, "%s ", agd->named_dest);
-                        }
+				if (!tracker_is_empty_string (agd->named_dest)) {
+					g_string_append_printf (*toc, "%s ", agd->named_dest);
+				}
 
-                        break;
-                }
+				break;
+			}
 
-                case POPPLER_ACTION_LAUNCH: {
-                        PopplerActionLaunch *al = (PopplerActionLaunch*) action;
+			case POPPLER_ACTION_LAUNCH: {
+				PopplerActionLaunch *al = (PopplerActionLaunch*) action;
 
-                        if (!tracker_is_empty_string (al->title)) {
-	                        g_string_append_printf (*toc, "%s ", al->title);
-                        }
+				if (!tracker_is_empty_string (al->title)) {
+					g_string_append_printf (*toc, "%s ", al->title);
+				}
 
-                        if (!tracker_is_empty_string (al->file_name)) {
-	                        g_string_append_printf (*toc, "%s ", al->file_name);
-                        }
+				if (!tracker_is_empty_string (al->file_name)) {
+					g_string_append_printf (*toc, "%s ", al->file_name);
+				}
 
-                        if (!tracker_is_empty_string (al->params)) {
-	                        g_string_append_printf (*toc, "%s ", al->params);
-                        }
+				if (!tracker_is_empty_string (al->params)) {
+					g_string_append_printf (*toc, "%s ", al->params);
+				}
 
-                        break;
-                }
+				break;
+			}
 
-                case POPPLER_ACTION_URI: {
-                        PopplerActionUri *au = (PopplerActionUri*) action;
+			case POPPLER_ACTION_URI: {
+				PopplerActionUri *au = (PopplerActionUri*) action;
 
-                        if (!tracker_is_empty_string (au->uri)) {
-	                        g_string_append_printf (*toc, "%s ", au->uri);
-                        }
+				if (!tracker_is_empty_string (au->uri)) {
+					g_string_append_printf (*toc, "%s ", au->uri);
+				}
 
-                        break;
-                }
+				break;
+			}
 
-                case POPPLER_ACTION_NAMED: {
-                        PopplerActionNamed *an = (PopplerActionNamed*) action;
+			case POPPLER_ACTION_NAMED: {
+				PopplerActionNamed *an = (PopplerActionNamed*) action;
 
-                        if (!tracker_is_empty_string (an->title)) {
-	                        g_string_append_printf (*toc, "%s, ", an->title);
-                        }
+				if (!tracker_is_empty_string (an->title)) {
+					g_string_append_printf (*toc, "%s, ", an->title);
+				}
 
-                        if (!tracker_is_empty_string (an->named_dest)) {
-                                g_string_append_printf (*toc, "%s ", an->named_dest);
-                        }
+				if (!tracker_is_empty_string (an->named_dest)) {
+					g_string_append_printf (*toc, "%s ", an->named_dest);
+				}
 
-                        break;
-                }
+				break;
+			}
 
-                case POPPLER_ACTION_MOVIE: {
-                        PopplerActionNamed *am = (PopplerActionNamed*) action;
+			case POPPLER_ACTION_MOVIE: {
+				PopplerActionNamed *am = (PopplerActionNamed*) action;
 
-                        if (!tracker_is_empty_string (am->title)) {
-	                        g_string_append_printf (*toc, "%s ", am->title);
-                        }
+				if (!tracker_is_empty_string (am->title)) {
+					g_string_append_printf (*toc, "%s ", am->title);
+				}
 
-                        break;
-                }
+				break;
+			}
 
-                case POPPLER_ACTION_NONE:
-                case POPPLER_ACTION_UNKNOWN:
-                case POPPLER_ACTION_GOTO_REMOTE:
-                        /* Do nothing */
-                        break;
-                }
+			case POPPLER_ACTION_NONE:
+			case POPPLER_ACTION_UNKNOWN:
+			case POPPLER_ACTION_GOTO_REMOTE:
+				/* Do nothing */
+				break;
+		}
 
-                iter = poppler_index_iter_get_child (index);
-                read_toc (iter, toc);
-        } while (poppler_index_iter_next (index));
+		iter = poppler_index_iter_get_child (index);
+		read_toc (iter, toc);
+	} while (poppler_index_iter_next (index));
 
-        poppler_index_iter_free (index);
+	poppler_index_iter_free (index);
 }
 
 static void
 read_outline (PopplerDocument      *document,
               TrackerSparqlBuilder *metadata)
 {
-        PopplerIndexIter *index;
-        GString *toc = NULL;
+	PopplerIndexIter *index;
+	GString *toc = NULL;
 
-        index = poppler_index_iter_new (document);
+	index = poppler_index_iter_new (document);
 
-        if (!index) {
-                return;
-        }
+	if (!index) {
+		return;
+	}
 
-        read_toc (index, &toc);
+	read_toc (index, &toc);
 
-        if (toc) {
-	        if (toc->len > 0) {
-		        tracker_sparql_builder_predicate (metadata, "nfo:tableOfContents");
-		        tracker_sparql_builder_object_unvalidated (metadata, toc->str);
-	        }
+	if (toc) {
+		if (toc->len > 0) {
+			tracker_sparql_builder_predicate (metadata, "nfo:tableOfContents");
+			tracker_sparql_builder_object_unvalidated (metadata, toc->str);
+		}
 
-	        g_string_free (toc, TRUE);
-        }
+		g_string_free (toc, TRUE);
+	}
 }
 
 static void
@@ -261,13 +261,11 @@ write_pdf_data (PDFData               data,
 	if (!tracker_is_empty_string (data.title)) {
 		tracker_sparql_builder_predicate (metadata, "nie:title");
 		tracker_sparql_builder_object_unvalidated (metadata, data.title);
-		g_free (data.title);
 	}
 
 	if (!tracker_is_empty_string (data.subject)) {
 		tracker_sparql_builder_predicate (metadata, "nie:subject");
 		tracker_sparql_builder_object_unvalidated (metadata, data.subject);
-		g_free (data.subject);
 	}
 
 	if (!tracker_is_empty_string (data.author)) {
@@ -278,18 +276,15 @@ write_pdf_data (PDFData               data,
 		tracker_sparql_builder_predicate (metadata, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (metadata, data.author);
 		tracker_sparql_builder_object_blank_close (metadata);
-		g_free (data.author);
 	}
 
 	if (!tracker_is_empty_string (data.date)) {
 		tracker_sparql_builder_predicate (metadata, "nie:contentCreated");
 		tracker_sparql_builder_object_unvalidated (metadata, data.date);
-		g_free (data.date);
 	}
 
 	if (!tracker_is_empty_string (data.keywords)) {
 		insert_keywords (metadata, data.keywords);
-		g_free (data.keywords);
 	}
 }
 
@@ -352,28 +347,27 @@ extract_pdf (const gchar          *uri,
 	if (xml) {
 		xd = tracker_xmp_new (xml, strlen (xml), uri);
 
-                if (!xd) {
-                        xd = g_new0 (TrackerXmpData, 1);
-                }
+		if (!xd) {
+			xd = g_new0 (TrackerXmpData, 1);
+		}
 
-                g_free (xml);
+		g_free (xml);
 		xml = NULL;
 
-		md.title = tracker_coalesce (3, pd.title, xd->title, xd->title2, xd->pdf_title);
-		md.subject = tracker_coalesce (2, pd.subject, xd->subject);
-		md.date = tracker_coalesce (3, pd.creation_date, xd->date, xd->time_original);
-		md.author = tracker_coalesce (2, pd.author, xd->creator);
+		/* The casts here are well understood and known */
+		md.title = (gchar *) tracker_coalesce_strip (3, pd.title, xd->title, xd->title2, xd->pdf_title);
+		md.subject = (gchar *) tracker_coalesce_strip (2, pd.subject, xd->subject);
+		md.date = (gchar *) tracker_coalesce_strip (3, pd.creation_date, xd->date, xd->time_original);
+		md.author = (gchar *) tracker_coalesce_strip (2, pd.author, xd->creator);
 
 		write_pdf_data (md, metadata);
 
 		if (xd->keywords) {
 			insert_keywords (metadata, xd->keywords);
-			g_free (xd->keywords);
 		}
 
 		if (xd->pdf_keywords) {
 			insert_keywords (metadata, xd->pdf_keywords);
-			g_free (xd->pdf_keywords);
 		}
 
 		if (xd->publisher) {
@@ -384,55 +378,46 @@ extract_pdf (const gchar          *uri,
 			tracker_sparql_builder_predicate (metadata, "nco:fullname");
 			tracker_sparql_builder_object_unvalidated (metadata, xd->publisher);
 			tracker_sparql_builder_object_blank_close (metadata);
-			g_free (xd->publisher);
 		}
 
 		if (xd->type) {
 			tracker_sparql_builder_predicate (metadata, "dc:type");
 			tracker_sparql_builder_object_unvalidated (metadata, xd->type);
-			g_free (xd->type);
 		}
 
 		if (xd->format) {
 			tracker_sparql_builder_predicate (metadata, "dc:format");
 			tracker_sparql_builder_object_unvalidated (metadata, xd->format);
-			g_free (xd->format);
 		}
 
 		if (xd->identifier) {
 			tracker_sparql_builder_predicate (metadata, "dc:identifier");
 			tracker_sparql_builder_object_unvalidated (metadata, xd->identifier);
-			g_free (xd->identifier);
 		}
 
 		if (xd->source) {
 			tracker_sparql_builder_predicate (metadata, "dc:source");
 			tracker_sparql_builder_object_unvalidated (metadata, xd->source);
-			g_free (xd->source);
 		}
 
 		if (xd->language) {
 			tracker_sparql_builder_predicate (metadata, "dc:language");
 			tracker_sparql_builder_object_unvalidated (metadata, xd->language);
-			g_free (xd->language);
 		}
 
 		if (xd->relation) {
 			tracker_sparql_builder_predicate (metadata, "dc:relation");
 			tracker_sparql_builder_object_unvalidated (metadata, xd->relation);
-			g_free (xd->relation);
 		}
 
 		if (xd->coverage) {
 			tracker_sparql_builder_predicate (metadata, "dc:coverage");
 			tracker_sparql_builder_object_unvalidated (metadata, xd->coverage);
-			g_free (xd->coverage);
 		}
 
 		if (xd->license) {
 			tracker_sparql_builder_predicate (metadata, "nie:license");
 			tracker_sparql_builder_object_unvalidated (metadata, xd->license);
-			g_free (xd->license);
 		}
 
 		if (xd->make || xd->model) {
@@ -440,11 +425,9 @@ extract_pdf (const gchar          *uri,
 
 			if ((xd->make == NULL || xd->model == NULL) ||
 			    (xd->make && xd->model && strstr (xd->model, xd->make) == NULL)) {
-				camera = tracker_merge (" ", 2, xd->make, xd->model);
+				camera = tracker_merge_const (" ", 2, xd->make, xd->model);
 			} else {
 				camera = g_strdup (xd->model);
-				g_free (xd->model);
-				g_free (xd->make);
 			}
 
 			tracker_sparql_builder_predicate (metadata, "nmm:camera");
@@ -455,19 +438,16 @@ extract_pdf (const gchar          *uri,
 		if (xd->orientation) {
 			tracker_sparql_builder_predicate (metadata, "nfo:orientation");
 			tracker_sparql_builder_object (metadata, xd->orientation);
-			g_free (xd->orientation);
 		}
 
 		if (xd->rights) {
 			tracker_sparql_builder_predicate (metadata, "nie:copyright");
 			tracker_sparql_builder_object_unvalidated (metadata, xd->rights);
-			g_free (xd->rights);
 		}
 
 		if (xd->white_balance) {
 			tracker_sparql_builder_predicate (metadata, "nmm:whiteBalance");
 			tracker_sparql_builder_object (metadata, xd->white_balance);
-			g_free (xd->white_balance);
 		}
 
 		if (xd->fnumber) {
@@ -476,13 +456,11 @@ extract_pdf (const gchar          *uri,
 			value = g_strtod (xd->fnumber, NULL);
 			tracker_sparql_builder_predicate (metadata, "nmm:fnumber");
 			tracker_sparql_builder_object_double (metadata, value);
-			g_free (xd->fnumber);
 		}
 
 		if (xd->flash) {
 			tracker_sparql_builder_predicate (metadata, "nmm:flash");
 			tracker_sparql_builder_object (metadata, xd->flash);
-			g_free (xd->flash);
 		}
 
 		if (xd->focal_length) {
@@ -491,15 +469,14 @@ extract_pdf (const gchar          *uri,
 			value = g_strtod (xd->focal_length, NULL);
 			tracker_sparql_builder_predicate (metadata, "nmm:focalLength");
 			tracker_sparql_builder_object_double (metadata, value);
-			g_free (xd->focal_length);
 		}
 
 		/* Question: Shouldn't xd->Artist be merged with md.author instead? */
 
 		if (xd->artist || xd->contributor) {
-			gchar *artist;
+			const gchar *artist;
 
-			artist = tracker_coalesce (2, xd->artist, xd->contributor);
+			artist = tracker_coalesce_strip (2, xd->artist, xd->contributor);
 			tracker_sparql_builder_predicate (metadata, "nco:contributor");
 			tracker_sparql_builder_object_blank_open (metadata);
 			tracker_sparql_builder_predicate (metadata, "a");
@@ -507,7 +484,6 @@ extract_pdf (const gchar          *uri,
 			tracker_sparql_builder_predicate (metadata, "nco:fullname");
 			tracker_sparql_builder_object_unvalidated (metadata, artist);
 			tracker_sparql_builder_object_blank_close (metadata);
-			g_free (artist);
 		}
 
 		if (xd->exposure_time) {
@@ -516,7 +492,6 @@ extract_pdf (const gchar          *uri,
 			value = g_strtod (xd->exposure_time, NULL);
 			tracker_sparql_builder_predicate (metadata, "nmm:exposureTime");
 			tracker_sparql_builder_object_double (metadata, value);
-			g_free (xd->exposure_time);
 		}
 
 		if (xd->iso_speed_ratings) {
@@ -525,59 +500,58 @@ extract_pdf (const gchar          *uri,
 			value = g_strtod (xd->iso_speed_ratings, NULL);
 			tracker_sparql_builder_predicate (metadata, "nmm:isoSpeed");
 			tracker_sparql_builder_object_double (metadata, value);
-			g_free (xd->iso_speed_ratings);
 		}
 
 		if (xd->description) {
 			tracker_sparql_builder_predicate (metadata, "nie:description");
 			tracker_sparql_builder_object_unvalidated (metadata, xd->description);
-			g_free (xd->description);
 		}
 
 		if (xd->metering_mode) {
 			tracker_sparql_builder_predicate (metadata, "nmm:meteringMode");
 			tracker_sparql_builder_object (metadata, xd->metering_mode);
-			g_free (xd->metering_mode);
 		}
 
 		if (xd->address || xd->country || xd->city) {
 			tracker_sparql_builder_predicate (metadata, "mlo:location");
-	
+
 			tracker_sparql_builder_object_blank_open (metadata);
 			tracker_sparql_builder_predicate (metadata, "a");
 			tracker_sparql_builder_object (metadata, "mlo:GeoPoint");
-	
+
 			if (xd->address) {
 				tracker_sparql_builder_predicate (metadata, "mlo:address");
 				tracker_sparql_builder_object_unvalidated (metadata, xd->address);
-				g_free (xd->address);
 			}
-	
+
 			if (xd->state) {
 				tracker_sparql_builder_predicate (metadata, "mlo:state");
 				tracker_sparql_builder_object_unvalidated (metadata, xd->state);
-				g_free (xd->state);
 			}
-	
+
 			if (xd->city) {
 				tracker_sparql_builder_predicate (metadata, "mlo:city");
 				tracker_sparql_builder_object_unvalidated (metadata, xd->city);
-				g_free (xd->city);
 			}
-	
+
 			if (xd->country) {
 				tracker_sparql_builder_predicate (metadata, "mlo:country");
 				tracker_sparql_builder_object_unvalidated (metadata, xd->country);
-				g_free (xd->country);
 			}
-		
+
 			tracker_sparql_builder_object_blank_close (metadata);
 		}
 
-		/* PDF keywords aren't used ATM */
+		/* PDF keywords aren't used ATM (why not?) */
 		g_free (pd.keywords);
 
-		tracker_xmp_free (xd, FALSE);
+		g_free (pd.title);
+		g_free (pd.subject);
+		g_free (pd.creation_date);
+		g_free (pd.author);
+		g_free (pd.date);
+
+		tracker_xmp_free (xd);
 	} else {
 		/* So if we are here we have NO XMP data and we just
 		 * write what we know from Poppler.
@@ -598,7 +572,7 @@ extract_pdf (const gchar          *uri,
 		g_free (content);
 	}
 
-        read_outline (document, metadata);
+	read_outline (document, metadata);
 
 	g_object_unref (document);
 }
diff --git a/src/tracker-extract/tracker-extract-png.c b/src/tracker-extract/tracker-extract-png.c
index 8187a66..a7913e0 100644
--- a/src/tracker-extract/tracker-extract-png.c
+++ b/src/tracker-extract/tracker-extract-png.c
@@ -33,38 +33,38 @@
 #define RFC1123_DATE_FORMAT "%d %B %Y %H:%M:%S %z"
 
 typedef struct {
-	gchar *title;
-	gchar *copyright;
-	gchar *creator;
-	gchar *description;
-	gchar *date;
-	gchar *license;
-	gchar *artist;
+	const gchar *title;
+	const gchar *copyright;
+	const gchar *creator;
+	const gchar *description;
+	const gchar *date;
+	const gchar *license;
+	const gchar *artist;
 	gchar *camera;
-	gchar *orientation;
-	gchar *white_balance;
-	gchar *fnumber;
-	gchar *flash;
-	gchar *focal_length;
-	gchar *exposure_time;
-	gchar *iso_speed_ratings;
-	gchar *metering_mode;
-	gchar *comment;
-	gchar *city;
-	gchar *state;
-	gchar *address;
-	gchar *country;
+	const gchar *orientation;
+	const gchar *white_balance;
+	const gchar *fnumber;
+	const gchar *flash;
+	const gchar *focal_length;
+	const gchar *exposure_time;
+	const gchar *iso_speed_ratings;
+	const gchar *metering_mode;
+	const gchar *comment;
+	const gchar *city;
+	const gchar *state;
+	const gchar *address;
+	const gchar *country;
 } MergeData;
 
 typedef struct {
-	gchar *author;
-	gchar *creator;
-	gchar *description;
-	gchar *comment;
-	gchar *copyright;
+	const gchar *author;
+	const gchar *creator;
+	const gchar *description;
+	const gchar *comment;
+	const gchar *copyright;
 	gchar *creation_time;
-	gchar *title;
-	gchar *disclaimer;
+	const gchar *title;
+	const gchar *disclaimer;
 } PngData;
 
 static void extract_png (const gchar          *filename,
@@ -132,8 +132,8 @@ read_metadata (TrackerSparqlBuilder *preupdate,
 {
 	MergeData md = { 0 };
 	PngData pd = { 0 };
-	TrackerExifData ed = { 0 };
-	TrackerXmpData xd = { 0 };
+	TrackerExifData *ed = NULL;
+	TrackerXmpData *xd = NULL;
 	png_textp text_ptr;
 	gint num_text;
 	gint i;
@@ -156,11 +156,9 @@ read_metadata (TrackerSparqlBuilder *preupdate,
 			 * theoretically possible that the function gets
 			 * called multiple times 
 			 */
-			tracker_xmp_read (text_ptr[i].text,
-			                  text_ptr[i].itxt_length,
-			                  uri, 
-			                  &xd);
-
+			xd = tracker_xmp_new (text_ptr[i].text,
+			                      text_ptr[i].itxt_length,
+			                      uri);
 			continue;
 		}
 #endif
@@ -171,36 +169,35 @@ read_metadata (TrackerSparqlBuilder *preupdate,
 		 * http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html#TextualData 
 		 */
 		if (g_strcmp0 ("Raw profile type exif", text_ptr[i].key) == 0) {
-			tracker_exif_read (text_ptr[i].text,
-			                   text_ptr[i].itxt_length, 
-			                   uri, 
-			                   &ed);
+			ed = tracker_exif_new (text_ptr[i].text,
+			                       text_ptr[i].itxt_length,
+			                       uri);
 			continue;
 		}
 #endif /* HAVE_LIBEXIF */
 
 		if (g_strcmp0 (text_ptr[i].key, "Author") == 0) {
-			pd.author = g_strdup (text_ptr[i].text);
+			pd.author = text_ptr[i].text;
 			continue;
 		}
 
 		if (g_strcmp0 (text_ptr[i].key, "Creator") == 0) {
-			pd.creator = g_strdup (text_ptr[i].text);
+			pd.creator = text_ptr[i].text;
 			continue;
 		}
 
 		if (g_strcmp0 (text_ptr[i].key, "Description") == 0) {
-			pd.description = g_strdup (text_ptr[i].text);
+			pd.description = text_ptr[i].text;
 			continue;
 		}
 
 		if (g_strcmp0 (text_ptr[i].key, "Comment") == 0) {
-			pd.comment = g_strdup (text_ptr[i].text);
+			pd.comment = text_ptr[i].text;
 			continue;
 		}
 
 		if (g_strcmp0 (text_ptr[i].key, "Copyright") == 0) {
-			pd.copyright = g_strdup (text_ptr[i].text);
+			pd.copyright = text_ptr[i].text;
 			continue;
 		}
 
@@ -210,75 +207,70 @@ read_metadata (TrackerSparqlBuilder *preupdate,
 		}
 
 		if (g_strcmp0 (text_ptr[i].key, "Title") == 0) {
-			pd.title = g_strdup (text_ptr[i].text);
+			pd.title = text_ptr[i].text;
 			continue;
 		}
 
 		if (g_strcmp0 (text_ptr[i].key, "Disclaimer") == 0) {
-			pd.disclaimer = g_strdup (text_ptr[i].text);
+			pd.disclaimer = text_ptr[i].text;
 			continue;
 		}
 	}
 
+	if (!ed) {
+		ed = g_new0 (TrackerExifData, 1);
+	}
+
+	if (!xd) {
+		xd = g_new0 (TrackerXmpData, 1);
+	}
+
 	/* Don't merge if the make is in the model */
-	if ((xd.make == NULL || xd.model == NULL) ||
-	    (xd.make && xd.model && strstr (xd.model, xd.make) == NULL)) {
-		md.camera = tracker_merge (" ", 2, xd.make, xd.model);
+	if ((xd->make == NULL || xd->model == NULL) ||
+	    (xd->make && xd->model && strstr (xd->model, xd->make) == NULL)) {
+		md.camera = tracker_merge_const (" ", 2, xd->make, xd->model);
 	} else {
-		md.camera = g_strdup (xd.model);
-		g_free (xd.model);
-		g_free (xd.make);
+		md.camera = g_strdup (xd->model);
 	}
 
 	if (!md.camera) {
-		if ((ed.make == NULL || ed.model == NULL) ||
-		    (ed.make && ed.model && strstr (ed.model, ed.make) == NULL)) {
-			md.camera = tracker_merge (" ", 2, ed.make, ed.model);
+		if ((ed->make == NULL || ed->model == NULL) ||
+		    (ed->make && ed->model && strstr (ed->model, ed->make) == NULL)) {
+			md.camera = tracker_merge_const (" ", 2, ed->make, ed->model);
 		} else {
-			md.camera = g_strdup (ed.model);
-			g_free (ed.model);
-			g_free (ed.make);
+			md.camera = g_strdup (ed->model);
 		}
-	} else {
-		g_free (ed.model);
-		g_free (ed.make);
-	}
-
-	md.creator = tracker_coalesce (3, xd.creator, pd.creator, pd.author);
-	md.title = tracker_coalesce (5, xd.title, pd.title, ed.document_name, xd.title2, xd.pdf_title);
-	md.copyright = tracker_coalesce (3, xd.rights, pd.copyright, ed.copyright);
-	md.license = tracker_coalesce (2, xd.license, pd.disclaimer);
-	md.description = tracker_coalesce (3, xd.description, pd.description, ed.description);
-	md.date = tracker_coalesce (5, xd.date, xd.time_original, pd.creation_time, ed.time, ed.time_original);
-	md.comment = tracker_coalesce (2, pd.comment, ed.user_comment);
-	md.artist = tracker_coalesce (3, xd.artist, ed.artist, xd.contributor);
-	md.orientation = tracker_coalesce (2, xd.orientation, ed.orientation);
-	md.exposure_time = tracker_coalesce (2, xd.exposure_time, ed.exposure_time);
-	md.iso_speed_ratings = tracker_coalesce (2, xd.iso_speed_ratings, ed.iso_speed_ratings);
-	md.fnumber = tracker_coalesce (2, xd.fnumber, ed.fnumber);
-	md.flash = tracker_coalesce (2, xd.flash, ed.flash);
-	md.focal_length = tracker_coalesce (2, xd.focal_length, ed.focal_length);
-	md.metering_mode = tracker_coalesce (2, xd.metering_mode, ed.metering_mode);
-	md.white_balance = tracker_coalesce (2, xd.white_balance, ed.white_balance);
+	}
+
+	md.creator = tracker_coalesce_strip (3, xd->creator, pd.creator, pd.author);
+	md.title = tracker_coalesce_strip (5, xd->title, pd.title, ed->document_name, xd->title2, xd->pdf_title);
+	md.copyright = tracker_coalesce_strip (3, xd->rights, pd.copyright, ed->copyright);
+	md.license = tracker_coalesce_strip (2, xd->license, pd.disclaimer);
+	md.description = tracker_coalesce_strip (3, xd->description, pd.description, ed->description);
+	md.date = tracker_coalesce_strip (5, xd->date, xd->time_original, pd.creation_time, ed->time, ed->time_original);
+	md.comment = tracker_coalesce_strip (2, pd.comment, ed->user_comment);
+	md.artist = tracker_coalesce_strip (3, xd->artist, ed->artist, xd->contributor);
+	md.orientation = tracker_coalesce_strip (2, xd->orientation, ed->orientation);
+	md.exposure_time = tracker_coalesce_strip (2, xd->exposure_time, ed->exposure_time);
+	md.iso_speed_ratings = tracker_coalesce_strip (2, xd->iso_speed_ratings, ed->iso_speed_ratings);
+	md.fnumber = tracker_coalesce_strip (2, xd->fnumber, ed->fnumber);
+	md.flash = tracker_coalesce_strip (2, xd->flash, ed->flash);
+	md.focal_length = tracker_coalesce_strip (2, xd->focal_length, ed->focal_length);
+	md.metering_mode = tracker_coalesce_strip (2, xd->metering_mode, ed->metering_mode);
+	md.white_balance = tracker_coalesce_strip (2, xd->white_balance, ed->white_balance);
 
 	if (md.comment) {
 		tracker_sparql_builder_predicate (metadata, "nie:comment");
 		tracker_sparql_builder_object_unvalidated (metadata, md.comment);
-		g_free (md.comment);
 	}
 
 	if (md.license) {
 		tracker_sparql_builder_predicate (metadata, "nie:license");
 		tracker_sparql_builder_object_unvalidated (metadata, md.license);
-		g_free (md.license);
 	}
 
-	/* TODO: add ontology and store this */
-	g_free (ed.software);
-
-	g_free (ed.x_dimension);
-	g_free (ed.y_dimension);
-	g_free (ed.image_width);
+	/* TODO: add ontology and store this ed->software */
+	g_free (ed->software);
 
 	if (md.creator) {
 		gchar *uri = tracker_uri_printf_escaped ("urn:contact:%s", md.creator);
@@ -290,7 +282,6 @@ read_metadata (TrackerSparqlBuilder *preupdate,
 		tracker_sparql_builder_predicate (preupdate, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (preupdate, md.creator);
 		tracker_sparql_builder_insert_close (preupdate);
-		g_free (md.creator);
 
 		tracker_sparql_builder_predicate (metadata, "nco:creator");
 		tracker_sparql_builder_object_iri (metadata, uri);
@@ -300,31 +291,26 @@ read_metadata (TrackerSparqlBuilder *preupdate,
 	if (md.date) {
 		tracker_sparql_builder_predicate (metadata, "nie:contentCreated");
 		tracker_sparql_builder_object_unvalidated (metadata, md.date);
-		g_free (md.date);
 	}
 
 	if (md.description) {
 		tracker_sparql_builder_predicate (metadata, "nie:description");
 		tracker_sparql_builder_object_unvalidated (metadata, md.description);
-		g_free (md.description);
 	}
 
 	if (md.copyright) {
 		tracker_sparql_builder_predicate (metadata, "nie:copyright");
 		tracker_sparql_builder_object_unvalidated (metadata, md.copyright);
-		g_free (md.copyright);
 	}
 
 	if (md.title) {
 		tracker_sparql_builder_predicate (metadata, "nie:title");
 		tracker_sparql_builder_object_unvalidated (metadata, md.title);
-		g_free (md.title);
 	}
 
 	if (md.camera) {
 		tracker_sparql_builder_predicate (metadata, "nmm:camera");
 		tracker_sparql_builder_object_unvalidated (metadata, md.camera);
-		g_free (md.camera);
 	}
 
 	if (md.artist) {
@@ -337,7 +323,6 @@ read_metadata (TrackerSparqlBuilder *preupdate,
 		tracker_sparql_builder_predicate (preupdate, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (preupdate, md.artist);
 		tracker_sparql_builder_insert_close (preupdate);
-		g_free (md.artist);
 
 		tracker_sparql_builder_predicate (metadata, "nco:contributor");
 		tracker_sparql_builder_object_iri (metadata, uri);
@@ -347,165 +332,145 @@ read_metadata (TrackerSparqlBuilder *preupdate,
 	if (md.orientation) {
 		tracker_sparql_builder_predicate (metadata, "nfo:orientation");
 		tracker_sparql_builder_object_unvalidated (metadata, md.orientation);
-		g_free (md.orientation);
 	}
 
 	if (md.exposure_time) {
 		tracker_sparql_builder_predicate (metadata, "nmm:exposureTime");
 		tracker_sparql_builder_object_unvalidated (metadata, md.exposure_time);
-		g_free (md.exposure_time);
 	}
 
 	if (md.iso_speed_ratings) {
 		tracker_sparql_builder_predicate (metadata, "nmm:isoSpeed");
 		tracker_sparql_builder_object_unvalidated (metadata, md.iso_speed_ratings);
-		g_free (md.iso_speed_ratings);
 	}
 
 	if (md.white_balance) {
 		tracker_sparql_builder_predicate (metadata, "nmm:whiteBalance");
 		tracker_sparql_builder_object_unvalidated (metadata, md.white_balance);
-		g_free (md.white_balance);
 	}
 
 	if (md.fnumber) {
 		tracker_sparql_builder_predicate (metadata, "nmm:fnumber");
 		tracker_sparql_builder_object_unvalidated (metadata, md.fnumber);
-		g_free (md.fnumber);
 	}
 
 	if (md.flash) {
 		tracker_sparql_builder_predicate (metadata, "nmm:flash");
 		tracker_sparql_builder_object_unvalidated (metadata, md.flash);
-		g_free (md.flash);
 	}
 
 	if (md.focal_length) {
 		tracker_sparql_builder_predicate (metadata, "nmm:focalLength");
 		tracker_sparql_builder_object_unvalidated (metadata, md.focal_length);
-		g_free (md.focal_length);
 	}
 
 	if (md.metering_mode) {
 		tracker_sparql_builder_predicate (metadata, "nmm:meteringMode");
 		tracker_sparql_builder_object_unvalidated (metadata, md.metering_mode);
-		g_free (md.metering_mode);
 	}
 
 
-	if (xd.keywords) {
-		insert_keywords (metadata, uri, xd.keywords);
-		g_free (xd.keywords);
+	if (xd->keywords) {
+		insert_keywords (metadata, uri, xd->keywords);
 	}
 
-	if (xd.pdf_keywords) {
-		insert_keywords (metadata, uri, xd.pdf_keywords);
-		g_free (xd.pdf_keywords);
+	if (xd->pdf_keywords) {
+		insert_keywords (metadata, uri, xd->pdf_keywords);
 	}
 
-	if (xd.rating) {
+	if (xd->rating) {
 		tracker_sparql_builder_predicate (metadata, "nao:numericRating");
-		tracker_sparql_builder_object_unvalidated (metadata, xd.rating);
-		g_free (xd.rating);
+		tracker_sparql_builder_object_unvalidated (metadata, xd->rating);
 	}
 
-	if (xd.subject) {
-		insert_keywords (metadata, uri, xd.subject);
-		g_free (xd.subject);
+	if (xd->subject) {
+		insert_keywords (metadata, uri, xd->subject);
 	}
 
-	if (xd.publisher) {
-		gchar *uri = tracker_uri_printf_escaped ("urn:contact:%s", xd.publisher);
+	if (xd->publisher) {
+		gchar *uri = tracker_uri_printf_escaped ("urn:contact:%s", xd->publisher);
 
 		tracker_sparql_builder_insert_open (preupdate, NULL);
 		tracker_sparql_builder_subject_iri (preupdate, uri);
 		tracker_sparql_builder_predicate (preupdate, "a");
 		tracker_sparql_builder_object (preupdate, "nco:Contact");
 		tracker_sparql_builder_predicate (preupdate, "nco:fullname");
-		tracker_sparql_builder_object_unvalidated (preupdate, xd.publisher);
+		tracker_sparql_builder_object_unvalidated (preupdate, xd->publisher);
 		tracker_sparql_builder_insert_close (preupdate);
-		g_free (xd.publisher);
 
 		tracker_sparql_builder_predicate (metadata, "nco:creator");
 		tracker_sparql_builder_object_iri (metadata, uri);
 		g_free (uri);
 	}
 
-	if (xd.type) {
+	if (xd->type) {
 		tracker_sparql_builder_predicate (metadata, "dc:type");
-		tracker_sparql_builder_object_unvalidated (metadata, xd.type);
-		g_free (xd.type);
+		tracker_sparql_builder_object_unvalidated (metadata, xd->type);
 	}
 
-	if (xd.format) {
+	if (xd->format) {
 		tracker_sparql_builder_predicate (metadata, "dc:format");
-		tracker_sparql_builder_object_unvalidated (metadata, xd.format);
-		g_free (xd.format);
+		tracker_sparql_builder_object_unvalidated (metadata, xd->format);
 	}
 
-	if (xd.identifier) {
+	if (xd->identifier) {
 		tracker_sparql_builder_predicate (metadata, "dc:identifier");
-		tracker_sparql_builder_object_unvalidated (metadata, xd.identifier);
-		g_free (xd.identifier);
+		tracker_sparql_builder_object_unvalidated (metadata, xd->identifier);
 	}
 
-	if (xd.source) {
+	if (xd->source) {
 		tracker_sparql_builder_predicate (metadata, "dc:source");
-		tracker_sparql_builder_object_unvalidated (metadata, xd.source);
-		g_free (xd.source);
+		tracker_sparql_builder_object_unvalidated (metadata, xd->source);
 	}
 
-	if (xd.language) {
+	if (xd->language) {
 		tracker_sparql_builder_predicate (metadata, "dc:language");
-		tracker_sparql_builder_object_unvalidated (metadata, xd.language);
-		g_free (xd.language);
+		tracker_sparql_builder_object_unvalidated (metadata, xd->language);
 	}
 
-	if (xd.relation) {
+	if (xd->relation) {
 		tracker_sparql_builder_predicate (metadata, "dc:relation");
-		tracker_sparql_builder_object_unvalidated (metadata, xd.relation);
-		g_free (xd.relation);
+		tracker_sparql_builder_object_unvalidated (metadata, xd->relation);
 	}
 
-	if (xd.coverage) {
+	if (xd->coverage) {
 		tracker_sparql_builder_predicate (metadata, "dc:coverage");
-		tracker_sparql_builder_object_unvalidated (metadata, xd.coverage);
-		g_free (xd.coverage);
+		tracker_sparql_builder_object_unvalidated (metadata, xd->coverage);
 	}
 
-	if (xd.address || xd.country || xd.city) {
+	if (xd->address || xd->country || xd->city) {
 		tracker_sparql_builder_predicate (metadata, "mlo:location");
 	
 		tracker_sparql_builder_object_blank_open (metadata);
 		tracker_sparql_builder_predicate (metadata, "a");
 		tracker_sparql_builder_object (metadata, "mlo:GeoPoint");
-	
-		if (xd.address) {
+
+		if (xd->address) {
 			tracker_sparql_builder_predicate (metadata, "mlo:address");
-			tracker_sparql_builder_object_unvalidated (metadata, xd.address);
-			g_free (xd.address);
+			tracker_sparql_builder_object_unvalidated (metadata, xd->address);
 		}
-	
-		if (xd.state) {
+
+		if (xd->state) {
 			tracker_sparql_builder_predicate (metadata, "mlo:state");
-			tracker_sparql_builder_object_unvalidated (metadata, xd.state);
-			g_free (xd.state);
+			tracker_sparql_builder_object_unvalidated (metadata, xd->state);
 		}
-	
-		if (xd.city) {
+
+		if (xd->city) {
 			tracker_sparql_builder_predicate (metadata, "mlo:city");
-			tracker_sparql_builder_object_unvalidated (metadata, xd.city);
-			g_free (xd.city);
+			tracker_sparql_builder_object_unvalidated (metadata, xd->city);
 		}
-	
-		if (xd.country) {
+
+		if (xd->country) {
 			tracker_sparql_builder_predicate (metadata, "mlo:country");
-			tracker_sparql_builder_object_unvalidated (metadata, xd.country);
-			g_free (xd.country);
+			tracker_sparql_builder_object_unvalidated (metadata, xd->country);
 		}
-		
+
 		tracker_sparql_builder_object_blank_close (metadata);
 	}
+
+	tracker_xmp_free (xd);
+	g_free (pd.creation_time);
+	g_free (md.camera);
 }
 
 static void
diff --git a/src/tracker-extract/tracker-extract-tiff.c b/src/tracker-extract/tracker-extract-tiff.c
index dab9fbc..b17087e 100644
--- a/src/tracker-extract/tracker-extract-tiff.c
+++ b/src/tracker-extract/tracker-extract-tiff.c
@@ -38,26 +38,26 @@ typedef enum {
 
 typedef struct {
 	gchar *camera;
-	gchar *title;
-	gchar *orientation;
-	gchar *copyright;
-	gchar *white_balance;
-	gchar *fnumber;
-	gchar *flash;
-	gchar *focal_length;
-	gchar *artist;
-	gchar *exposure_time;
-	gchar *iso_speed_ratings;
-	gchar *date;
-	gchar *description;
-	gchar *metering_mode;
-	gchar *creator;
-	gchar *x_dimension;
-	gchar *y_dimension;
-	gchar *city;
-	gchar *state;
-	gchar *address;
-	gchar *country;
+	const gchar *title;
+	const gchar *orientation;
+	const gchar *copyright;
+	const gchar *white_balance;
+	const gchar *fnumber;
+	const gchar *flash;
+	const gchar *focal_length;
+	const gchar *artist;
+	const gchar *exposure_time;
+	const gchar *iso_speed_ratings;
+	const gchar *date;
+	const gchar *description;
+	const gchar *metering_mode;
+	const gchar *creator;
+	const gchar *x_dimension;
+	const gchar *y_dimension;
+	const gchar *city;
+	const gchar *state;
+	const gchar *address;
+	const gchar *country;
 } MergeData;
 
 typedef struct {
@@ -82,6 +82,21 @@ static TrackerExtractData extract_data[] = {
 	{ NULL, NULL }
 };
 
+static void
+tiff_data_free (TiffData *tags)
+{
+	g_free (tags->artist);
+	g_free (tags->copyright);
+	g_free (tags->date);
+	g_free (tags->title);
+	g_free (tags->description);
+	g_free (tags->width);
+	g_free (tags->length);
+	g_free (tags->make);
+	g_free (tags->model);
+	g_free (tags->orientation);
+}
+
 static gchar *
 get_flash (TIFF *image)
 {
@@ -270,7 +285,7 @@ insert_keywords (TrackerSparqlBuilder *metadata,
 static void
 extract_tiff (const gchar          *uri,
               TrackerSparqlBuilder *preupdate,
-	      TrackerSparqlBuilder *metadata)
+              TrackerSparqlBuilder *metadata)
 {
 	TIFF *image;
 	TrackerXmpData *xd = NULL;
@@ -317,9 +332,9 @@ extract_tiff (const gchar          *uri,
 	}
 #endif /* HAVE_LIBIPTCDATA */
 
-        if (!id) {
-                id = g_new0 (TrackerIptcData, 1);
-        }
+	if (!id) {
+		id = g_new0 (TrackerIptcData, 1);
+	}
 
 	/* FIXME There are problems between XMP data embedded with different tools
 	   due to bugs in the original spec (type) */
@@ -329,11 +344,11 @@ extract_tiff (const gchar          *uri,
 	}
 #endif /* HAVE_EXEMPI */
 
-        if (!xd) {
-                xd = g_new0 (TrackerXmpData, 1);
-        }
+	if (!xd) {
+		xd = g_new0 (TrackerXmpData, 1);
+	}
 
-        ed = g_new0 (TrackerExifData, 1);
+	ed = g_new0 (TrackerExifData, 1);
 
 	/* Get Tiff specifics */
 	td.width = tag_to_string (image, TIFFTAG_IMAGEWIDTH, TAG_TYPE_UINT32);
@@ -372,76 +387,62 @@ extract_tiff (const gchar          *uri,
 	TIFFClose (image);
 	g_free (filename);
 
-	md.camera = tracker_merge (" ", 2, xd->make, xd->model);
+	md.camera = tracker_merge_const (" ", 2, xd->make, xd->model);
 
 	if (!md.camera) {
-		md.camera = tracker_merge (" ", 2, td.make, td.model);
+		md.camera = tracker_merge_const (" ", 2, td.make, td.model);
 
 		if (!md.camera) {
-			md.camera = tracker_merge (" ", 2, ed->make, ed->model);
-		} else {
-			g_free (ed->model);
-			g_free (ed->make);
+			md.camera = tracker_merge_const (" ", 2, ed->make, ed->model);
 		}
-	} else {
-		g_free (td.model);
-		g_free (td.make);
-		g_free (ed->model);
-		g_free (ed->make);
-	}
-
-	md.title = tracker_coalesce (5, xd->title, xd->pdf_title, td.title, ed->document_name, xd->title2);
-	md.orientation = tracker_coalesce (4, xd->orientation, td.orientation, ed->orientation, id->image_orientation);
-	md.copyright = tracker_coalesce (4, xd->rights, td.copyright, ed->copyright, id->copyright_notice);
-	md.white_balance = tracker_coalesce (2, xd->white_balance, ed->white_balance);
-	md.fnumber = tracker_coalesce (2, xd->fnumber, ed->fnumber);
-	md.flash = tracker_coalesce (2, xd->flash, ed->flash);
-	md.focal_length = tracker_coalesce (2, xd->focal_length, ed->focal_length);
-	md.artist = tracker_coalesce (4, xd->artist, td.artist, ed->artist, xd->contributor);
-	md.exposure_time = tracker_coalesce (2, xd->exposure_time, ed->exposure_time);
-	md.iso_speed_ratings = tracker_coalesce (2, xd->iso_speed_ratings, ed->iso_speed_ratings);
-	md.date = tracker_coalesce (6, xd->date, xd->time_original, td.date, ed->time, id->date_created, ed->time_original);
-	md.description = tracker_coalesce (3, xd->description, td.description, ed->description);
-	md.metering_mode = tracker_coalesce (2, xd->metering_mode, ed->metering_mode);
-	md.city = tracker_coalesce (2, xd->city, id->city);
-	md.state = tracker_coalesce (2, xd->state, id->state);
-	md.address = tracker_coalesce (2, xd->address, id->sublocation);
-	md.country = tracker_coalesce (2, xd->country, id->country_name);
-	md.creator = tracker_coalesce (3, xd->creator, id->byline, id->credit);
-	md.x_dimension = tracker_coalesce (2, td.width, ed->x_dimension);
-	md.y_dimension = tracker_coalesce (2, td.length, ed->y_dimension);
+	}
+
+	md.title = tracker_coalesce_strip (5, xd->title, xd->pdf_title, td.title, ed->document_name, xd->title2);
+	md.orientation = tracker_coalesce_strip (4, xd->orientation, td.orientation, ed->orientation, id->image_orientation);
+	md.copyright = tracker_coalesce_strip (4, xd->rights, td.copyright, ed->copyright, id->copyright_notice);
+	md.white_balance = tracker_coalesce_strip (2, xd->white_balance, ed->white_balance);
+	md.fnumber = tracker_coalesce_strip (2, xd->fnumber, ed->fnumber);
+	md.flash = tracker_coalesce_strip (2, xd->flash, ed->flash);
+	md.focal_length = tracker_coalesce_strip (2, xd->focal_length, ed->focal_length);
+	md.artist = tracker_coalesce_strip (4, xd->artist, td.artist, ed->artist, xd->contributor);
+	md.exposure_time = tracker_coalesce_strip (2, xd->exposure_time, ed->exposure_time);
+	md.iso_speed_ratings = tracker_coalesce_strip (2, xd->iso_speed_ratings, ed->iso_speed_ratings);
+	md.date = tracker_coalesce_strip (6, xd->date, xd->time_original, td.date, ed->time, id->date_created, ed->time_original);
+	md.description = tracker_coalesce_strip (3, xd->description, td.description, ed->description);
+	md.metering_mode = tracker_coalesce_strip (2, xd->metering_mode, ed->metering_mode);
+	md.city = tracker_coalesce_strip (2, xd->city, id->city);
+	md.state = tracker_coalesce_strip (2, xd->state, id->state);
+	md.address = tracker_coalesce_strip (2, xd->address, id->sublocation);
+	md.country = tracker_coalesce_strip (2, xd->country, id->country_name);
+	md.creator = tracker_coalesce_strip (3, xd->creator, id->byline, id->credit);
+	md.x_dimension = tracker_coalesce_strip (2, td.width, ed->x_dimension);
+	md.y_dimension = tracker_coalesce_strip (2, td.length, ed->y_dimension);
 
 	if (ed->user_comment) {
 		tracker_sparql_builder_predicate (metadata, "nie:comment");
 		tracker_sparql_builder_object_unvalidated (metadata, ed->user_comment);
-		g_free (ed->user_comment);
 	}
 
 	if (md.x_dimension) {
 		tracker_sparql_builder_predicate (metadata, "nfo:width");
 		tracker_sparql_builder_object_unvalidated (metadata, md.x_dimension);
-		g_free (md.x_dimension);
 	}
 
 	if (md.y_dimension) {
 		tracker_sparql_builder_predicate (metadata, "nfo:height");
 		tracker_sparql_builder_object_unvalidated (metadata, md.y_dimension);
-		g_free (md.y_dimension);
 	}
 
 	if (xd->keywords) {
 		insert_keywords (metadata, uri, xd->keywords);
-		g_free (xd->keywords);
 	}
 
 	if (xd->pdf_keywords) {
 		insert_keywords (metadata, uri, xd->pdf_keywords);
-		g_free (xd->pdf_keywords);
 	}
 
 	if (xd->subject) {
 		insert_keywords (metadata, uri, xd->subject);
-		g_free (xd->subject);
 	}
 
 	if (xd->publisher) {
@@ -454,7 +455,6 @@ extract_tiff (const gchar          *uri,
 		tracker_sparql_builder_predicate (preupdate, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (preupdate, xd->publisher);
 		tracker_sparql_builder_insert_close (preupdate);
-		g_free (xd->publisher);
 
 		tracker_sparql_builder_predicate (metadata, "nco:publisher");
 		tracker_sparql_builder_object_iri (metadata, uri);
@@ -464,55 +464,46 @@ extract_tiff (const gchar          *uri,
 	if (xd->type) {
 		tracker_sparql_builder_predicate (metadata, "dc:type");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->type);
-		g_free (xd->type);
 	}
 
 	if (xd->format) {
 		tracker_sparql_builder_predicate (metadata, "dc:format");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->format);
-		g_free (xd->format);
 	}
 
 	if (xd->identifier) {
 		tracker_sparql_builder_predicate (metadata, "dc:identifier");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->identifier);
-		g_free (xd->identifier);
 	}
 
 	if (xd->source) {
 		tracker_sparql_builder_predicate (metadata, "dc:source");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->source);
-		g_free (xd->source);
 	}
 
 	if (xd->language) {
 		tracker_sparql_builder_predicate (metadata, "dc:language");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->language);
-		g_free (xd->language);
 	}
 
 	if (xd->relation) {
 		tracker_sparql_builder_predicate (metadata, "dc:relation");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->relation);
-		g_free (xd->relation);
 	}
 
 	if (xd->coverage) {
 		tracker_sparql_builder_predicate (metadata, "dc:coverage");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->coverage);
-		g_free (xd->coverage);
 	}
 
 	if (xd->rating) {
 		tracker_sparql_builder_predicate (metadata, "nao:numericRating");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->rating);
-		g_free (xd->rating);
 	}
 
 	if (xd->license) {
 		tracker_sparql_builder_predicate (metadata, "nie:license");
 		tracker_sparql_builder_object_unvalidated (metadata, xd->license);
-		g_free (xd->license);
 	}
 
 	if (md.city || md.state || md.address || md.country) {
@@ -521,31 +512,27 @@ extract_tiff (const gchar          *uri,
 		tracker_sparql_builder_object_blank_open (metadata);
 		tracker_sparql_builder_predicate (metadata, "a");
 		tracker_sparql_builder_object (metadata, "mlo:GeoPoint");
-	
+
 		if (md.address) {
 			tracker_sparql_builder_predicate (metadata, "mlo:address");
 			tracker_sparql_builder_object_unvalidated (metadata, md.address);
-			g_free (md.address);
 		}
-	
+
 		if (md.state) {
 			tracker_sparql_builder_predicate (metadata, "mlo:state");
 			tracker_sparql_builder_object_unvalidated (metadata, md.state);
-			g_free (md.state);
 		}
-	
+
 		if (md.city) {
 			tracker_sparql_builder_predicate (metadata, "mlo:city");
 			tracker_sparql_builder_object_unvalidated (metadata, md.city);
-			g_free (md.city);
 		}
-	
+
 		if (md.country) {
 			tracker_sparql_builder_predicate (metadata, "mlo:country");
 			tracker_sparql_builder_object_unvalidated (metadata, md.country);
-			g_free (md.country);
 		}
-		
+
 		tracker_sparql_builder_object_blank_close (metadata);
 	}
 
@@ -559,7 +546,6 @@ extract_tiff (const gchar          *uri,
 		tracker_sparql_builder_predicate (preupdate, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (preupdate, id->contact);
 		tracker_sparql_builder_insert_close (preupdate);
-		g_free (id->contact);
 
 		tracker_sparql_builder_predicate (metadata, "nco:representative");
 		tracker_sparql_builder_object_iri (metadata, uri);
@@ -568,55 +554,46 @@ extract_tiff (const gchar          *uri,
 
 	if (id->keywords) {
 		insert_keywords (metadata, uri, id->keywords);
-		g_free (id->keywords);
 	}
 
 	if (md.camera) {
 		tracker_sparql_builder_predicate (metadata, "nmm:camera");
 		tracker_sparql_builder_object_unvalidated (metadata, md.camera);
-		g_free (md.camera);
 	}
 
 	if (md.title) {
 		tracker_sparql_builder_predicate (metadata, "nie:title");
 		tracker_sparql_builder_object_unvalidated (metadata, md.title);
-		g_free (md.title);
 	}
 
 	if (md.orientation) {
 		tracker_sparql_builder_predicate (metadata, "nfo:orientation");
 		tracker_sparql_builder_object_unvalidated (metadata, md.orientation);
-		g_free (md.orientation);
 	}
 
 	if (md.copyright) {
 		tracker_sparql_builder_predicate (metadata, "nie:copyright");
 		tracker_sparql_builder_object_unvalidated (metadata, md.copyright);
-		g_free (md.copyright);
 	}
 
 	if (md.white_balance) {
 		tracker_sparql_builder_predicate (metadata, "nmm:whiteBalance");
 		tracker_sparql_builder_object_unvalidated (metadata, md.white_balance);
-		g_free (md.white_balance);
 	}
 
 	if (md.fnumber) {
 		tracker_sparql_builder_predicate (metadata, "nmm:fnumber");
 		tracker_sparql_builder_object_unvalidated (metadata, md.fnumber);
-		g_free (md.fnumber);
 	}
 
 	if (md.flash) {
 		tracker_sparql_builder_predicate (metadata, "nmm:flash");
 		tracker_sparql_builder_object_unvalidated (metadata, md.flash);
-		g_free (md.flash);
 	}
 
 	if (md.focal_length) {
 		tracker_sparql_builder_predicate (metadata, "nmm:focalLength");
 		tracker_sparql_builder_object_unvalidated (metadata, md.focal_length);
-		g_free (md.focal_length);
 	}
 
 	if (md.artist) {
@@ -629,7 +606,6 @@ extract_tiff (const gchar          *uri,
 		tracker_sparql_builder_predicate (preupdate, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (preupdate, uri);
 		tracker_sparql_builder_insert_close (preupdate);
-		g_free (md.artist);
 
 		tracker_sparql_builder_predicate (metadata, "nco:contributor");
 		tracker_sparql_builder_object_iri (metadata, uri);
@@ -639,31 +615,26 @@ extract_tiff (const gchar          *uri,
 	if (md.exposure_time) {
 		tracker_sparql_builder_predicate (metadata, "nmm:exposureTime");
 		tracker_sparql_builder_object_unvalidated (metadata, md.exposure_time);
-		g_free (md.exposure_time);
 	}
 
 	if (md.iso_speed_ratings) {
 		tracker_sparql_builder_predicate (metadata, "nmm:isoSpeed");
 		tracker_sparql_builder_object_unvalidated (metadata, md.iso_speed_ratings);
-		g_free (md.iso_speed_ratings);
 	}
 
 	if (md.date) {
 		tracker_sparql_builder_predicate (metadata, "nie:contentCreated");
 		tracker_sparql_builder_object_unvalidated (metadata, md.date);
-		g_free (md.date);
 	}
 
 	if (md.description) {
 		tracker_sparql_builder_predicate (metadata, "nie:description");
 		tracker_sparql_builder_object_unvalidated (metadata, md.description);
-		g_free (md.description);
 	}
 
 	if (md.metering_mode) {
 		tracker_sparql_builder_predicate (metadata, "nmm:meteringMode");
 		tracker_sparql_builder_object_unvalidated (metadata, md.metering_mode);
-		g_free (md.metering_mode);
 	}
 
 	if (md.creator) {
@@ -676,7 +647,6 @@ extract_tiff (const gchar          *uri,
 		tracker_sparql_builder_predicate (preupdate, "nco:fullname");
 		tracker_sparql_builder_object_unvalidated (preupdate, md.creator);
 		tracker_sparql_builder_insert_close (preupdate);
-		g_free (md.creator);
 
 		/* NOTE: We only have affiliation with
 		 * nco:PersonContact and we are using
@@ -706,10 +676,11 @@ extract_tiff (const gchar          *uri,
 		g_free (uri);
 	}
 
-	g_free (id->byline_title);
-
-        tracker_xmp_free (xd, FALSE);
-        tracker_iptc_free (id, FALSE);
+	g_free (md.camera);
+	tiff_data_free (&td);
+	tracker_exif_free (ed);
+	tracker_xmp_free (xd);
+	tracker_iptc_free (id);
 }
 
 TrackerExtractData *
diff --git a/src/tracker-extract/tracker-extract-vorbis.c b/src/tracker-extract/tracker-extract-vorbis.c
index c69aaa6..84b2f5e 100644
--- a/src/tracker-extract/tracker-extract-vorbis.c
+++ b/src/tracker-extract/tracker-extract-vorbis.c
@@ -169,7 +169,7 @@ extract_vorbis (const char *uri,
 		vorbis_comment_clear (comment);
 	}
 
-	md.creator = tracker_coalesce (3, vd.artist, vd.album_artist, vd.performer);
+	md.creator = tracker_coalesce_strip (3, vd.artist, vd.album_artist, vd.performer);
 
 	if (md.creator) {
 		gchar *uri = tracker_uri_printf_escaped ("urn:artist:%s", md.creator);
@@ -436,6 +436,10 @@ extract_vorbis (const char *uri,
 		tracker_sparql_builder_object_int64 (metadata, (gint64) time);
 	}
 
+	g_free (vd.artist);
+	g_free (vd.album_artist);
+	g_free (vd.performer);
+
 	/* NOTE: This calls fclose on the file */
 	ov_clear (&vf);
 }
diff --git a/src/tracker-extract/tracker-extract-xmp.c b/src/tracker-extract/tracker-extract-xmp.c
index a32ee14..96d0c68 100644
--- a/src/tracker-extract/tracker-extract-xmp.c
+++ b/src/tracker-extract/tracker-extract-xmp.c
@@ -153,12 +153,12 @@ extract_xmp (const gchar          *uri,
 		                      length,
 		                      original_uri ? original_uri : uri);
 
-                if (xd) {
-                        tracker_xmp_apply (metadata, uri, xd);
-                }
+		if (xd) {
+			tracker_xmp_apply (metadata, uri, xd);
+		}
 
 		g_free (original_uri);
-                tracker_xmp_free (xd, TRUE);
+		tracker_xmp_free (xd);
 	}
 
 	g_free (filename);



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