[libvirt] [PATCH] qemud: don't dereference NULL on failed virGetUserDirectory

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

 



I spotted this while merging my unix_sock_dir changes:

>From 04373207bc838c31bd07596df3c676476e73c983 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Fri, 23 Jan 2009 13:59:28 +0100
Subject: [PATCH] qemud: don't dereference NULL on failed virGetUserDirectory

* qemud/qemud.c (qemudInitPaths): Check for OOM.
---
 qemud/qemud.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/qemud/qemud.c b/qemud/qemud.c
index 55f31d5..84034f3 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -719,6 +719,10 @@ static int qemudInitPaths(struct qemud_server *server,
             goto snprintf_error;
     } else {
         char *userdir = virGetUserDirectory(NULL, uid);
+        if (userdir == NULL) {
+            /* give no diagnostic here; virGetUserDirectory reports OOM  */
+            return -1;
+        }

         if (snprintf(sockname, maxlen, "@%s/.libvirt/libvirt-sock", userdir) >= maxlen) {
             VIR_FREE(userdir);
--
1.6.1.354.gd9e51

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]