diff --git a/thunar/thunar-list-model.c b/thunar/thunar-list-model.c
index 1c10f91d0ee75b0c4dc94bfaee1a2e90dcf8daa0..b55fde73e241d420a6d3282ca2a569363fdf6534 100644
--- a/thunar/thunar-list-model.c
+++ b/thunar/thunar-list-model.c
@@ -1556,7 +1556,7 @@ sort_by_type (const ThunarFile *a,
   gint         result;
 
   content_type_a = thunar_file_get_content_type (a);
-  content_type_b = thunar_file_get_content_type (a);
+  content_type_b = thunar_file_get_content_type (b);
 
   description_a = g_content_type_get_description (content_type_a);
   description_b = g_content_type_get_description (content_type_b);
@@ -1566,6 +1566,9 @@ sort_by_type (const ThunarFile *a,
   if (result == 0)
     result = sort_by_name (a, b, case_sensitive);
 
+  g_free (description_a);
+  g_free (description_b);
+
   return result;
 }