I spotted this while merging my unix_sock_dir changes:
From 04373207bc838c31bd07596df3c676476e73c983 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
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, "(a)%s/.libvirt/libvirt-sock", userdir)
>= maxlen) {
VIR_FREE(userdir);
--
1.6.1.354.gd9e51