[libvirt] [PATCH v2] cgroup: reuse buffer for getline

Eric Blake eblake at redhat.com
Wed Jul 17 11:24:49 UTC 2013


On 07/17/2013 04:00 AM, Ján Tomko wrote:
> Reuse the buffer for getline and track buffer allocation
> separately from the string length to prevent unlikely
> out-of-bounds memory access.
> 
> This fixes the following leak that happened when zero bytes were read:
> 
> ==404== 120 bytes in 1 blocks are definitely lost in loss record 1,344 of 1,671
> ==404==    at 0x4C2C71B: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==404==    by 0x906F862: getdelim (iogetdelim.c:68)
> ==404==    by 0x52A48FB: virCgroupPartitionNeedsEscaping (vircgroup.c:1136)
> ==404==    by 0x52A0FB4: virCgroupPartitionEscape (vircgroup.c:1171)
> ==404==    by 0x52A0EA4: virCgroupNewDomainPartition (vircgroup.c:1450)
> ---
> v1: cgroup: Free line even if no characters were read
> https://www.redhat.com/archives/libvir-list/2013-July/msg01030.html
> 
>  src/util/vircgroup.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130717/28620810/attachment-0001.sig>


More information about the libvir-list mailing list