ratpoison-devel
[Top][All Lists]
Advanced

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

[RP] [PATCH] Free string allocated by getline() in history_load()


From: Repolho
Subject: [RP] [PATCH] Free string allocated by getline() in history_load()
Date: Wed, 7 Aug 2013 14:32:25 -0300
User-agent: Mutt/1.5.21 (2010-09-15)

Note: this is another very minor leak, since it only happens once while loading
the history file, but I thought I'd throw it in as well.

history.c:history_load() calls getline(), but fails to free the string
allocated by that function.

To reproduce, simply run ratpoison with a valid ~/.ratpoison_history file,
which results in (taken from valgrind's log):

120 bytes in 1 blocks are definitely lost in loss record 125 of 193
   at 0x4C2C04B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0x5C11A2D: getdelim (in /usr/lib/libc-2.17.so)
   by 0x41A155: history_load (history.c:195)
   by 0x41D0A2: main (main.c:720)

The attached patch fixes the issue. It was generated over the latest git,
v1.4.6-48-gb02d855.

Attachment: history_load_leak.patch
Description: Text Data


reply via email to

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