[PATCH 2/2] parthelper: Don't leak @canonical_path
Michal Privoznik
mprivozn at redhat.com
Thu Oct 22 11:01:50 UTC 2020
The @canonical_path variable holds canonicalized path passed as
argv[1]. The canonicalized path is obtained either via
virFileResolveLink() or plain g_strdup(). Nevertheless, in both
cases it must be freed.
Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
src/storage/parthelper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c
index 29a01d3dd5..caa2e8fa62 100644
--- a/src/storage/parthelper.c
+++ b/src/storage/parthelper.c
@@ -62,7 +62,7 @@ int main(int argc, char **argv)
PedPartition *part;
int cmd = DISK_LAYOUT;
const char *path;
- char *canonical_path;
+ g_autofree char *canonical_path = NULL;
const char *partsep;
bool devmap_partsep = false;
--
2.26.2
More information about the libvir-list
mailing list