mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 06:50:22 +03:00
capabilities: reduce scope in virCapabilitiesInitCaches()
over-writing a variable in inner while-loop without freeing previous memory leaks it over time. To fix this, we can just change scope of bank variable to the inner loop. Signed-off-by: Shaleen Bathla <shaleen.bathla@oracle.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Fixes: 5c84485439ee63f40002c04914e111395c598db0 Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
27d8bcc337
commit
9a3bccf695
@ -2178,7 +2178,6 @@ virCapabilitiesInitCaches(virCaps *caps)
|
||||
int rv = -1;
|
||||
g_autoptr(DIR) dirp = NULL;
|
||||
g_autofree char *path = g_strdup_printf("%s/cpu/cpu%zd/cache/", SYSFS_SYSTEM_PATH, pos);
|
||||
g_autoptr(virCapsHostCacheBank) bank = NULL;
|
||||
|
||||
rv = virDirOpenIfExists(&dirp, path);
|
||||
if (rv < 0)
|
||||
@ -2189,6 +2188,7 @@ virCapabilitiesInitCaches(virCaps *caps)
|
||||
|
||||
while ((rv = virDirRead(dirp, &ent, path)) > 0) {
|
||||
g_autofree char *type = NULL;
|
||||
g_autoptr(virCapsHostCacheBank) bank = NULL;
|
||||
int kernel_type;
|
||||
unsigned int level;
|
||||
int ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user