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

From f124b132913884ced6e9fbae8233056e0e97cd0a Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@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

2009/12/14 Jim Meyering <jim@meyering.net>:
From f124b132913884ced6e9fbae8233056e0e97cd0a Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@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
ACK. Matthias

Matthias Bolte wrote:
2009/12/14 Jim Meyering <jim@meyering.net>:
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. ACK
Thanks for the reviews. I've pushed those two.
participants (2)
-
Jim Meyering
-
Matthias Bolte