From: Michal Privoznik <mprivozn(a)redhat.com>
The @mem_path variable inside of get_files() is used only within
a single block. Move its declaration inside it. And also utilize
automatic memory freeing.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/security/virt-aa-helper.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 2fac65f108..64cada3b3b 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -866,7 +866,6 @@ get_files(vahControl * ctl)
int rc = -1;
size_t i;
char *uuid;
- char *mem_path = NULL;
char uuidstr[VIR_UUID_STRING_BUFLEN];
bool needsVfio = false, needsvhost = false, needsgl = false;
@@ -1210,6 +1209,8 @@ get_files(vahControl * ctl)
"rw") != 0)
goto cleanup;
} else {
+ g_autofree char *mem_path = NULL;
+
switch (shmem->model) {
case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_PLAIN:
/* until exposed, recreate qemuBuildShmemBackendMemProps */
@@ -1361,7 +1362,6 @@ get_files(vahControl * ctl)
ctl->files = virBufferContentAndReset(&buf);
cleanup:
- VIR_FREE(mem_path);
VIR_FREE(uuid);
return rc;
}
--
2.49.0