[PATCH 2/7] util: Resolve resource leak in virExec error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On error, the @pidfilefd was not released

Found by Coverity

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/util/vircommand.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index e47dd6b932..1716225aeb 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -792,12 +792,14 @@ virExec(virCommandPtr cmd)
         if (virSetInherit(pidfilefd, true) < 0) {
             virReportSystemError(errno, "%s",
                                  _("Cannot disable close-on-exec flag"));
+            virPidFileReleasePath(cmd->pidfile, pidfilefd);
             goto fork_error;
         }
 
         c = '1';
         if (safewrite(pipesync[1], &c, sizeof(c)) != sizeof(c)) {
             virReportSystemError(errno, "%s", _("Unable to notify child process"));
+            virPidFileReleasePath(cmd->pidfile, pidfilefd);
             goto fork_error;
         }
         VIR_FORCE_CLOSE(pipesync[0]);
-- 
2.28.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux