Re: Leak and strange code in nautilus-file.c

On Wed, 2005-01-26 at 15:12 +0100, Kjartan Maraas wrote:
> Hi.
> Valgrind reports this leak in nautilus-file.c:
> ==5836== 304 bytes in 7 blocks are definitely lost in loss record 136 of 220
> ==5836==    at 0x1B904278: malloc (vg_replace_malloc.c:130)
> ==5836==    by 0x1C3FEA09: IA__g_malloc (gmem.c:137)
> ==5836==    by 0x1C07942B: gnome_vfs_unescape_string (gnome-vfs-utils.c:467)
> ==5836==    by 0x1B94B157: nautilus_file_get_name (nautilus-file.c:2763)
> ==5836==    by 0x1B94B62D: nautilus_file_get_display_name_nocopy (nautilus-file.c:2698)
> ==5836==    by 0x1B94B8F6: nautilus_file_get_display_name (nautilus-file.c:2757)
> ==5836==    by 0x8099552: fm_icon_container_get_icon_text (fm-icon-container.c:275)
> ==5836==    by 0x1B95DD3B: nautilus_icon_container_update_icon (nautilus-icon-container.c:4851)
> ==5836==    by 0x1B95E23D: redo_layout_internal (nautilus-icon-container.c:5102)
> ==5836==    by 0x1B95E46A: redo_layout_callback (nautilus-icon-container.c:1645)
> ==5836==    by 0x1C3FBBBF: g_idle_dispatch (gmain.c:3821)
> ==5836==    by 0x1C3F8D70: IA__g_main_context_dispatch (gmain.c:1947)
> ==5836==    by 0x1C3FA64E: g_main_context_iterate (gmain.c:2578)
> ==5836==    by 0x1C3FA8CF: IA__g_main_loop_run (gmain.c:2782)
> ==5836==    by 0x1BDCCEB6: IA__gtk_main (gtkmain.c:963)
> ==5836==    by 0x8074A74: main (nautilus-main.c:353)
> And the code in nautilus_file_display_name_nocopy() seems to be setting
> name to different values throughout without freeing the previous value
> first. It seems a bit strange to be setting it and then setting it
> again, and again though. Maybe a bug? I can't really say I fully
> understand the code in there so I might be mistaken of course.

I don't understand how this could leak.
file->details->cached_display_name should always be freed when the file
is freed.

Also, i don't understand your problem with
nautilus_file_display_name_nocopy(). It never sets name if its already
been set to non-NULL in the function, except in one place where we free
it first.

 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's a hate-fuelled soccer-playing matador on his last day in the job. She's a 
vivacious psychic vampire operating on the wrong side of the law. They fight 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]