==16259== 32 (16 direct, 16 indirect) bytes in 2 blocks are definitely lost in loss record 93 of 305 ==16259== at 0x401B7F3: operator new(unsigned) (vg_replace_malloc.c:164) ==16259== by 0x42C6B1F: poppler_page_get_text (poppler-page.cc:633) ==16259== by 0x8097742: pdf_document_get_text(_EvDocument*, int, EvRectangle*) (ev-poppler.cc:538) ==16259== by 0x808BE63: ev_document_get_text (ev-document.c:183) ==16259== by 0x806F81C: get_selected_text (ev-view.c:3812) ==16259== by 0x806F97D: ev_view_primary_get_cb (ev-view.c:3854) Code: poppler_page_get_text (PopplerPage *page, PopplerRectangle *selection) { [...] GooString *sel_text = new GooString; [...] sel_text = text_dev->getSelectionText (&pdf_selection); result = g_strdup (sel_text->getCString ()); delete sel_text; return result; } text_dev->getSelectionText returns a new'd GooString too, so this leaks.
Created attachment 4865 [details] [review] fix leak
The first hunk of the patch looks good. The second hunk seems unrelated. What is it about?
(In reply to comment #2) > The first hunk of the patch looks good. The second hunk seems unrelated. What > is it about? Oh sorry I forgot to remove it, it's unrelated to this bug. It saves a strdup (g_value_set_string strdups, but since we're going to call g_free, we can just transfer the string to the GValue with g_value_take_string).
patch committed.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.