mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
virCapabilitiesInitCaches: Don't leak cache dir
To every virDirOpen we must have VIR_DIR_CLOSE otherwise FD is leaked. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
f25f30aff5
commit
0b60f88791
@ -1555,6 +1555,8 @@ virCapabilitiesInitCaches(virCapsPtr caps)
|
||||
if (virAsprintf(&path, "%s/cpu/cpu%zd/cache/", SYSFS_SYSTEM_PATH, pos) < 0)
|
||||
goto cleanup;
|
||||
|
||||
VIR_DIR_CLOSE(dirp);
|
||||
|
||||
rv = virDirOpenIfExists(&dirp, path);
|
||||
if (rv < 0)
|
||||
goto cleanup;
|
||||
@ -1639,7 +1641,7 @@ virCapabilitiesInitCaches(virCapsPtr caps)
|
||||
cleanup:
|
||||
VIR_FREE(type);
|
||||
VIR_FREE(path);
|
||||
virDirClose(&dirp);
|
||||
VIR_DIR_CLOSE(dirp);
|
||||
virCapsHostCacheBankFree(bank);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user