libvirt/libvirt-0.4.1-qemud1.patch

39 lines
1.0 KiB
Diff
Raw Normal View History

Avoid segfault upon early libvirtd failure.
* qemud/qemud.c (main): Don't call qemudCleanup on an
uninitialized pointer.
By the way, even though this evoked a warning from gcc,
"make distcheck" passes. Obviously, that means the distcheck
rule is inadequate. I'll fix it so that it turns on -Werror
for the final build.
Signed-off-by: Jim Meyering <meyering@redhat.com>
---
qemud/qemud.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/qemud/qemud.c b/qemud/qemud.c
index 96fdf32..b6b82ed 100644
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -2025,7 +2025,7 @@ libvirt management daemon:\n\
#define MAX_LISTEN 5
int main(int argc, char **argv) {
- struct qemud_server *server;
+ struct qemud_server *server = NULL;
struct sigaction sig_action;
int sigpipe[2];
const char *pid_file = NULL;
@@ -2180,7 +2180,8 @@ int main(int argc, char **argv) {
unlink (pid_file);
error1:
- qemudCleanup(server);
+ if (server)
+ qemudCleanup(server);
return ret;
}