mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 06:50:22 +03:00
ch: Free @iothreads array in virCHProcessSetupIOThreads()
When the CH driver starts a domain virCHProcessSetupIOThreads() is called eventually which in turn calls virCHMonitorGetIOThreads(). The latter returns an array of iothreads which is never freed leading to a memleak: 130 (104 direct, 26 indirect) bytes in 1 blocks are definitely lost in loss record 1,804 of 1,998 at 0x484CEF3: calloc (vg_replace_malloc.c:1675) by 0x4F0E7A9: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.8000.5) by 0xB3A9359: virCHMonitorGetIOThreads (ch_monitor.c:1183) by 0xB3AA5BB: virCHProcessSetupIOThreads (ch_process.c:348) by 0xB3AAC59: virCHProcessSetup (ch_process.c:480) 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) by 0x4B1FB99: virNetServerProgramDispatch (virnetserverprogram.c:299) Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
1b25f1e53b
commit
b9a10cf4bb
@ -344,6 +344,7 @@ virCHProcessSetupIOThreads(virDomainObj *vm)
|
||||
virDomainIOThreadInfo **iothreads = NULL;
|
||||
size_t i;
|
||||
int niothreads;
|
||||
int ret = -1;
|
||||
|
||||
if ((niothreads = virCHMonitorGetIOThreads(priv->monitor, &iothreads)) < 0)
|
||||
return -1;
|
||||
@ -351,9 +352,16 @@ virCHProcessSetupIOThreads(virDomainObj *vm)
|
||||
for (i = 0; i < niothreads; i++) {
|
||||
VIR_DEBUG("IOThread index = %zu , tid = %d", i, iothreads[i]->iothread_id);
|
||||
if (virCHProcessSetupIOThread(vm, iothreads[i]) < 0)
|
||||
return -1;
|
||||
goto cleanup;
|
||||
}
|
||||
return 0;
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
for (i = 0; i < niothreads; i++) {
|
||||
virDomainIOThreadInfoFree(iothreads[i]);
|
||||
}
|
||||
g_free(iothreads);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
x
Reference in New Issue
Block a user