aboutsummaryrefslogtreecommitdiffstats
path: root/src/coopgammad.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-08-05 14:13:22 +0200
committerMattias Andrée <maandree@kth.se>2016-08-05 14:13:22 +0200
commit272464fac03859636383f1d9eeafe8af56470ab1 (patch)
tree47c0b05ecc83866c03e3af5da5a5edb66ed9de88 /src/coopgammad.c
parentFix reading of uninitialised value (diff)
downloadcoopgammad-272464fac03859636383f1d9eeafe8af56470ab1.tar.gz
coopgammad-272464fac03859636383f1d9eeafe8af56470ab1.tar.bz2
coopgammad-272464fac03859636383f1d9eeafe8af56470ab1.tar.xz
Fix bugs
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/coopgammad.c')
-rw-r--r--src/coopgammad.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/coopgammad.c b/src/coopgammad.c
index 83352e0..1276189 100644
--- a/src/coopgammad.c
+++ b/src/coopgammad.c
@@ -419,14 +419,13 @@ static enum init_status initialise(int foreground, int keep_stderr, int query)
static void destroy(int full)
{
if (full)
- disconnect_all();
-
- if (full)
- close_socket(socketpath);
-
- if (full && (outputs != NULL))
- restore_gamma();
-
+ {
+ disconnect_all();
+ close_socket(socketpath);
+ free(argv0_real);
+ if (outputs != NULL)
+ restore_gamma();
+ }
state_destroy();
free(socketpath);
if (full && (pidpath != NULL))
@@ -618,7 +617,11 @@ static char* reexecute(void)
destroy(0);
+#if !defined(USE_VALGRIND)
execlp(argv0_real ? argv0_real : argv0, argv0, "- ", statefile, NULL);
+#else
+ execlp("valgrind", "valgrind", "--leak-check=full", argv0_real ? argv0_real : argv0, "- ", statefile, NULL);
+#endif
saved_errno = errno;
free(argv0_real), argv0_real = NULL;
errno = saved_errno;