diff --git a/libnautilus-private/nautilus-desktop-metadata.c b/libnautilus-private/nautilus-desktop-metadata.c
index 524a97a..a8856e2 100644
--- a/libnautilus-private/nautilus-desktop-metadata.c
+++ b/libnautilus-private/nautilus-desktop-metadata.c
@@ -68,6 +68,7 @@ save_in_idle_cb (gpointer data)
 		g_file_set_contents (filename,
 				     contents, length,
 				     &error);
+		g_free (contents);
 	}
 
 	if (error != NULL) {
@@ -76,6 +77,8 @@ save_in_idle_cb (gpointer data)
 		g_error_free (error);
 	}
 
+	g_free (filename);
+
 	return FALSE;
 }
 
