spice-vdagent/0005-vdagent-Fix-double-free-on-re-exec.patch
Hans de Goede 6ccc771729 Make the per session agent process automatically reconnect to the system
spice-vdagentd when the system daemon gets restarted
2011-07-15 12:11:41 +02:00

48 lines
1.2 KiB
Diff

From e1c0ba33dff4f937b9c0f8f5bae42f2787691654 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Fri, 15 Jul 2011 11:40:46 +0200
Subject: [linux-vdagent PATCH] vdagent: Fix double free on re-exec
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is caused by me fixing a memleak in the non re-exec reconnect patch
of Marc-André's original patch before merging it.
---
src/vdagent.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/src/vdagent.c b/src/vdagent.c
index 5bf0452..5371ca2 100644
--- a/src/vdagent.c
+++ b/src/vdagent.c
@@ -150,15 +150,6 @@ static int file_test(const char *path)
return stat(path, &buffer);
}
-static void cleanup(void)
-{
- vdagent_x11_destroy(x11);
- udscs_destroy_connection(&client);
-
- if (logfile != stderr)
- fclose(logfile);
-}
-
int main(int argc, char *argv[])
{
fd_set readfds, writefds;
@@ -228,7 +219,8 @@ int main(int argc, char *argv[])
reconnect:
if (version_mismatch) {
fprintf(logfile, "Version mismatch, restarting\n");
- cleanup();
+ if (logfile != stderr)
+ fclose(logfile);
sleep(1);
execvp(argv[0], argv);
}
--
1.7.5.1