aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-log-store-empathy.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/libempathy/empathy-log-store-empathy.c b/libempathy/empathy-log-store-empathy.c
index 2088fca03..1aa8c049e 100644
--- a/libempathy/empathy-log-store-empathy.c
+++ b/libempathy/empathy-log-store-empathy.c
@@ -620,20 +620,22 @@ log_store_empathy_search_new (EmpathyLogStore *self,
gchar *filename;
GMappedFile *file;
gsize length;
- gchar *contents;
- gchar *contents_casefold;
+ gchar *contents = NULL;
+ gchar *contents_casefold = NULL;
filename = l->data;
file = g_mapped_file_new (filename, FALSE, NULL);
- if (!file)
- continue;
+ if (file == NULL)
+ goto drinking_island;
length = g_mapped_file_get_length (file);
contents = g_mapped_file_get_contents (file);
- contents_casefold = g_utf8_casefold (contents, length);
- g_mapped_file_unref (file);
+ if (length == 0 || contents == NULL)
+ goto drinking_island;
+
+ contents_casefold = g_utf8_casefold (contents, length);
if (strstr (contents_casefold, text_casefold))
{
@@ -649,6 +651,10 @@ log_store_empathy_search_new (EmpathyLogStore *self,
}
}
+drinking_island:
+ if (file != NULL)
+ g_mapped_file_unref (file);
+
g_free (contents_casefold);
g_free (filename);
}