]> xenbits.xensource.com Git - libvirt.git/commitdiff
parthelper: Don't leak @canonical_path
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 22 Oct 2020 10:55:40 +0000 (12:55 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 22 Oct 2020 11:47:23 +0000 (13:47 +0200)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/storage/parthelper.c

index 29a01d3dd52cbc73ff9ba4c6d2fb73d6680efb88..caa2e8fa6234e7e7d4abbb3cceb12373d6af730d 100644 (file)
@@ -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;