Bug 1303885

Summary: Memory leak in virtlogd.
Product: [Community] Virtualization Tools Reporter: Fangge Jin <fjin>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: crobinso, dyuan, mzhan, rbalakri, yafu, zhwang
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-11 11:33:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Fangge Jin 2016-02-02 10:43:33 UTC
Description of problem:
There is memory leak in virtlogd

Version-Release number of selected component:
# rpm -q libvirt
libvirt-1.3.2-1.fc24_v1.3.1_79_g63e15ad.x86_64


How reproducible:
100%

Steps to Reproduce:
1.
# valgrind --leak-check=full virtlogd --timeout=30
==2118== Memcheck, a memory error detector
==2118== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==2118== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==2118== Command: virtlogd --timeout=30
==2118==
==2118==
==2118== HEAP SUMMARY:
==2118==     in use at exit: 15,774 bytes in 330 blocks
==2118==   total heap usage: 1,910 allocs, 1,580 frees, 246,957 bytes allocated
==2118==
==2118== 27 bytes in 1 blocks are definitely lost in loss record 23 of 63
==2118==    at 0x4C2DC50: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==2118==    by 0x7784C89: strdup (strdup.c:42)
==2118==    by 0x16065E: virStrdup (virstring.c:726)
==2118==    by 0x123829: virLogDaemonConfigFilePath (log_daemon_config.c:100)
==2118==    by 0x12256C: main (log_daemon.c:1014)
==2118==
==2118== 88 (32 direct, 56 indirect) bytes in 1 blocks are definitely lost in loss record 44 of 63
==2118==    at 0x4C2F9C7: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==2118==    by 0x13A333: virAlloc (viralloc.c:144)
==2118==    by 0x1238FE: virLogDaemonConfigNew (log_daemon_config.c:127)
==2118==    by 0x121474: main (log_daemon.c:1006)
==2118==
==2118== LEAK SUMMARY:
==2118==    definitely lost: 59 bytes in 2 blocks
==2118==    indirectly lost: 56 bytes in 1 blocks
==2118==      possibly lost: 0 bytes in 0 blocks
==2118==    still reachable: 15,659 bytes in 327 blocks
==2118==         suppressed: 0 bytes in 0 blocks
==2118== Reachable blocks (those to which a pointer was found) are not shown.
==2118== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==2118==
==2118== For counts of detected and suppressed errors, rerun with: -v
==2118== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)




Actual results:
As step1 shown, there is memory leak in virtlogd

Expected results:
No memory leak.

Comment 1 Cole Robinson 2016-04-10 23:22:37 UTC
Sent a patch upstream:

http://www.redhat.com/archives/libvir-list/2016-April/msg00474.html

Comment 2 Cole Robinson 2016-04-11 11:33:32 UTC
commit cdced0128a45fb44c687325376311dabb1116324
Author: Cole Robinson <crobinso>
Date:   Sun Apr 10 19:19:25 2016 -0400

    virtlogd: Fix a couple minor memory leaks