mirror of https://gitee.com/openkylin/libvirt.git
storage: do not leak storage pool XML filename
Valgrind complained: ==28277== 38 bytes in 1 blocks are definitely lost in loss record 298 of 957 ==28277== at 0x4A06A2E: malloc (vg_replace_malloc.c:270) ==28277== by 0x82D7F57: __vasprintf_chk (in /lib64/libc-2.12.so) ==28277== by 0x52EF16A: virVasprintfInternal (stdio2.h:199) ==28277== by 0x52EF25C: virAsprintfInternal (virstring.c:514) ==28277== by 0x52B1FA9: virFileBuildPath (virfile.c:2831) ==28277== by 0x19B1947C: storageDriverAutostart (storage_driver.c:191) ==28277== by 0x19B196A7: storageStateAutoStart (storage_driver.c:307) ==28277== by 0x538527E: virStateInitialize (libvirt.c:793) ==28277== by 0x11D7CF: daemonRunStateInit (libvirtd.c:947) ==28277== by 0x52F4694: virThreadHelper (virthread.c:206) ==28277== by 0x6E08A50: start_thread (in /lib64/libpthread-2.12.so) ==28277== by 0x82BE93C: clone (in /lib64/libc-2.12.so) Signed-off-by: Michael Chapman <mike@very.puzzling.org>
This commit is contained in:
parent
28c9eea032
commit
c494db8fd6
|
@ -151,7 +151,6 @@ static void
|
|||
storageDriverAutostart(void)
|
||||
{
|
||||
size_t i;
|
||||
char *stateFile = NULL;
|
||||
virConnectPtr conn = NULL;
|
||||
|
||||
/* XXX Remove hardcoding of QEMU URI */
|
||||
|
@ -187,6 +186,8 @@ storageDriverAutostart(void)
|
|||
}
|
||||
|
||||
if (started) {
|
||||
char *stateFile;
|
||||
|
||||
virStoragePoolObjClearVols(pool);
|
||||
stateFile = virFileBuildPath(driver->stateDir,
|
||||
pool->def->name, ".xml");
|
||||
|
@ -201,11 +202,10 @@ storageDriverAutostart(void)
|
|||
VIR_ERROR(_("Failed to autostart storage pool '%s': %s"),
|
||||
pool->def->name, err ? err->message :
|
||||
_("no error message found"));
|
||||
VIR_FREE(stateFile);
|
||||
virStoragePoolObjUnlock(pool);
|
||||
continue;
|
||||
} else {
|
||||
pool->active = true;
|
||||
}
|
||||
pool->active = true;
|
||||
VIR_FREE(stateFile);
|
||||
}
|
||||
virStoragePoolObjUnlock(pool);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue