[Top][All Lists]

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

Memory leak in info completion

From: Vitezslav Crhonek
Subject: Memory leak in info completion
Date: Thu, 26 Jul 2018 09:33:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0


There's a mem leak in 'info_read_completing_internal' function

In indefinite 'while(1)' cycle, storage is returned from allocation
function 'echo_area_after_read' into 'line' pointer variable (line 946).

If the cycle repeats ('continue' in '/* If no match, go back and try
again. */' case on line 982), the 'line' pointer is overwritten, which
leaks the storage 'line' originally pointed to.

Steps to reproduce:
1) run '$ valgrind --leak-check=full info gcc'
2) hit 'f' key ('Follow xref:' appears in echo area)
3) write 's?' and hit ENTER ('[No completions]' appears in echo area)
4) leave info (hit ESC, ESC and 'q' key) and see valgrind summary

If you hit ENTER more often in step number three, the amount of leaked
memory will increase.

Attached patch resolves the issue.

Best regards,

Vitezslav Crhonek
Software Engineer
Red Hat

Attachment: completion-mem-leak.patch
Description: Text Data

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]