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

Re: [libvirt] [PATCH 1/4] libvirtd: avoid memory leak on OOM



于 2011年07月01日 07:36, Eric Blake 写道:
Detected by Coverity; only strikes on OOM so not serious.

* daemon/libvirtd.c (daemonPidFilePath): Plug leak.
---
  daemon/libvirtd.c |    4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 60ee705..06d2077 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -310,8 +310,10 @@ daemonPidFilePath(bool privileged,
          if (!(userdir = virGetUserDirectory(geteuid())))
              goto error;

-        if (virAsprintf(pidfile, "%s/.libvirt/libvirtd.pid", userdir)<  0)
+        if (virAsprintf(pidfile, "%s/.libvirt/libvirtd.pid", userdir)<  0) {
+            VIR_FREE(userdir);
              goto no_memory;
+        }

          VIR_FREE(userdir);
      }

ACK

Regards
Osier


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