Plug a mem leak in g-file-info test
authorChristian Persch <chpe@gnome.org>
Fri, 3 Sep 2010 19:37:08 +0000 (15:37 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 3 Sep 2010 19:37:08 +0000 (15:37 -0400)
==2395== 64 bytes in 1 blocks are definitely lost in loss record 381 of 407
==2395==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==2395==    by 0x4005C66: realloc (vg_replace_malloc.c:476)
==2395==    by 0x40571A5: g_realloc (gmem.c:181)
==2395==    by 0x401D670: g_ptr_array_maybe_expand (garray.c:968)
==2395==    by 0x401DD0B: g_ptr_array_add (garray.c:1225)
==2395==    by 0x4199AA9: g_file_info_list_attributes (gfileinfo.c:646)
==2395==    by 0x80491CE: test_g_file_info (g-file-info.c:76)

==2395== 132 (64 direct, 68 indirect) bytes in 1 blocks are definitely lost in loss record 396 of 407
==2395==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==2395==    by 0x4005C66: realloc (vg_replace_malloc.c:476)
==2395==    by 0x40571A5: g_realloc (gmem.c:181)
==2395==    by 0x401D670: g_ptr_array_maybe_expand (garray.c:968)
==2395==    by 0x401DD0B: g_ptr_array_add (garray.c:1225)
==2395==    by 0x4199A82: g_file_info_list_attributes (gfileinfo.c:642)
==2395==    by 0x80492B7: test_g_file_info (g-file-info.c:86)

Bug #628331.

gio/tests/g-file-info.c

index 80bdd6e..ec0ae27 100644 (file)
@@ -76,7 +76,8 @@ test_g_file_info (void)
   attr_list = g_file_info_list_attributes (info, NULL);
   g_assert (attr_list != NULL);
   g_assert (*attr_list == NULL);
-       
+  g_strfreev (attr_list);
+
   g_file_info_set_attribute_byte_string (info, G_FILE_ATTRIBUTE_STANDARD_NAME, TEST_NAME);
   g_file_info_set_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME, TEST_DISPLAY_NAME);
   g_file_info_set_attribute_uint64 (info, G_FILE_ATTRIBUTE_STANDARD_SIZE, TEST_SIZE);
@@ -86,7 +87,8 @@ test_g_file_info (void)
   attr_list = g_file_info_list_attributes (info, NULL);
   g_assert (attr_list != NULL);
   g_assert (*attr_list != NULL);
-       
+  g_strfreev (attr_list);
+
   test_assigned_values (info);
        
   /*  Test dups */