[libvirt] [PATCH] libvirtd: avoid a NULL dereference on error path

Jim Meyering jim at meyering.net
Mon Dec 14 15:47:51 UTC 2009



>From f124b132913884ced6e9fbae8233056e0e97cd0a Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Mon, 14 Dec 2009 16:45:11 +0100
Subject: [PATCH] libvirtd: avoid a NULL dereference on error path

* daemon/libvirtd.c (qemudDispatchServer): Since "client" may be
NULL in the "cleanup:" block, free client->rx only when it's not.
---
 daemon/libvirtd.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 6b7e33d..de6fc27 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1422,7 +1422,8 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket
     if (client &&
         client->tlssession) gnutls_deinit (client->tlssession);
     close (fd);
-    VIR_FREE(client->rx);
+    if (client)
+        VIR_FREE(client->rx);
     VIR_FREE(client);
     return -1;
 }
--
1.6.6.rc2.275.g51e2d




More information about the libvir-list mailing list