Fix memleak in log_store_empathy_get_chats_for_dir. Only build filename if its
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 17 Apr 2009 21:00:10 +0000 (23:00 +0200)
committerLars-Peter Clausen <lars@metafoo.de>
Tue, 21 Apr 2009 08:42:13 +0000 (10:42 +0200)
needed and freed again.

libempathy/empathy-log-store-empathy.c

index 11e64e0efc5a9a39a1ec1daf835e52eab3c45f3c..37a76676f5c84e948cc25f5f7884c9ee41edb11c 100644 (file)
@@ -641,17 +641,15 @@ log_store_empathy_get_chats_for_dir (EmpathyLogStore *self,
   while ((name = g_dir_read_name (gdir)) != NULL)
     {
       EmpathyLogSearchHit *hit;
-      gchar *filename;
 
-      filename = g_build_filename (dir, name, NULL);
       if (!is_chatroom && strcmp (name, LOG_DIR_CHATROOMS) == 0)
         {
+          gchar *filename = g_build_filename (dir, name, NULL);
           hits = g_list_concat (hits, log_store_empathy_get_chats_for_dir (
                 self, filename, TRUE));
           g_free (filename);
           continue;
         }
-
       hit = g_slice_new0 (EmpathyLogSearchHit);
       hit->chat_id = g_strdup (name);
       hit->is_chatroom = is_chatroom;