qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] qemu-nbd.c : fix memory leak


From: Mark Wu
Subject: Re: [Qemu-devel] [PATCH] qemu-nbd.c : fix memory leak
Date: Fri, 02 Dec 2011 15:28:41 +0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110927 Red Hat/3.1.15-1.el6_1 Thunderbird/3.1.15

On 12/02/2011 11:34 AM, Li Zhi Hui wrote:
Signed-off-by: Li Zhi Hui<address@hidden>
---
  qemu-nbd.c |    4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/qemu-nbd.c b/qemu-nbd.c
index 291cba2..ab7fa6c 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -500,8 +500,10 @@ int main(int argc, char **argv)
          sharing_fds[0] = tcp_socket_incoming(bindto, port);
      }

-    if (sharing_fds[0] == -1)
+    if (sharing_fds[0] == -1) {
+        g_free(sharing_fds);
          return 1;
+    }

      if (device) {
          int ret;
Zhihui,

Kernel should free all memory used by the process after it exits. So there's no memory leak even without explicit free.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]