There are two places where curl_slist_append() is called but corresponding call to curl_slist_free_all() is missing: virCHMonitorPutNoContent() and virCHMonitorGet() which leads to memleaks: 41 (16 direct, 25 indirect) bytes in 1 blocks are definitely lost in loss record 992 of 1,998 at 0x4845888: malloc (vg_replace_malloc.c:446) by 0x5B2F8FE: curl_slist_append (in /usr/lib64/libcurl.so.4.8.0) by 0xB3A7B41: virCHMonitorPutNoContent (ch_monitor.c:824) by 0xB3A89FF: virCHMonitorBootVM (ch_monitor.c:1030) by 0xB3AC6F1: virCHProcessStart (ch_process.c:967) by 0xB39B7D4: chDomainCreateXML (ch_driver.c:246) by 0x4CC9D32: virDomainCreateXML (libvirt-domain.c:188) by 0x168F91: remoteDispatchDomainCreateXML (remote_daemon_dispatch_stubs.h:5186) by 0x168F18: remoteDispatchDomainCreateXMLHelper (remote_daemon_dispatch_stubs.h:5167) by 0x4B20066: virNetServerProgramDispatchCall (virnetserverprogram.c:423) by 0x4B1FB99: virNetServerProgramDispatch (virnetserverprogram.c:299) by 0x4B28B5E: virNetServerProcessMsg (virnetserver.c:135) 88 (16 direct, 72 indirect) bytes in 1 blocks are definitely lost in loss record 1,501 of 1,998 at 0x4845888: malloc (vg_replace_malloc.c:446) by 0x5B2F8FE: curl_slist_append (in /usr/lib64/libcurl.so.4.8.0) by 0xB3A7E41: virCHMonitorGet (ch_monitor.c:864) by 0xB3A92E2: virCHMonitorGetInfo (ch_monitor.c:1157) by 0xB3A9CEA: virCHProcessUpdateInfo (ch_process.c:142) by 0xB3AAD36: virCHProcessSetup (ch_process.c:492) by 0xB3AC75A: virCHProcessStart (ch_process.c:973) by 0xB39B7D4: chDomainCreateXML (ch_driver.c:246) by 0x4CC9D32: virDomainCreateXML (libvirt-domain.c:188) by 0x168F91: remoteDispatchDomainCreateXML (remote_daemon_dispatch_stubs.h:5186) by 0x168F18: remoteDispatchDomainCreateXMLHelper (remote_daemon_dispatch_stubs.h:5167) by 0x4B20066: virNetServerProgramDispatchCall (virnetserverprogram.c:423) Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/ch/ch_monitor.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index e0d6b490de..0ba927a194 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -839,6 +839,8 @@ virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint, if (responseCode == 200 || responseCode == 204) ret = 0; + curl_slist_free_all(headers); + return ret; } @@ -884,6 +886,7 @@ virCHMonitorGet(virCHMonitor *mon, const char *endpoint, virJSONValue **response cleanup: g_free(data.content); + curl_slist_free_all(headers); /* reset the libcurl handle to avoid leaking a stack pointer to data */ curl_easy_reset(mon->handle); -- 2.48.1