[libvirt] [PATCH] virPidFileConstructPath: Drop useless VIR_FREE()

Michal Privoznik mprivozn at redhat.com
Wed Apr 15 13:04:43 UTC 2015


If a virAsprintf() within the function fails, we call VIR_FREE()
over @rundir variable and jump onto cleanup label, where it is
freed again.  It doesn't hurt, but not make much sense too.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---

Pushed as trivial.

 src/util/virpidfile.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index a77a326..8144ff9 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -556,11 +556,8 @@ virPidFileConstructPath(bool privileged,
             goto cleanup;
         }
 
-        if (virAsprintf(pidfile, "%s/%s.pid", rundir, progname) < 0) {
-            VIR_FREE(rundir);
+        if (virAsprintf(pidfile, "%s/%s.pid", rundir, progname) < 0)
             goto cleanup;
-        }
-
     }
 
     ret = 0;
-- 
2.0.5




More information about the libvir-list mailing list