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>
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)
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;