From b67c2ac413ac7d4be1660bb626284328b6521143 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Sun, 23 Jun 2013 10:52:24 +0800 Subject: [PATCH 3/5] dbus-launch: check SIGHUP definition and free args on failure Signed-off-by: Chengwei Yang --- tools/dbus-launch.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c index f34072a..beea27e 100644 --- a/tools/dbus-launch.c +++ b/tools/dbus-launch.c @@ -475,7 +475,9 @@ kill_bus_when_session_ends (void) act.sa_handler = signal_handler; act.sa_mask = empty_mask; act.sa_flags = 0; +#ifdef SIGHUP sigaction (SIGHUP, &act, NULL); +#endif sigaction (SIGTERM, &act, NULL); sigaction (SIGINT, &act, NULL); @@ -766,8 +768,11 @@ pass_info (const char *runprog, const char *bus_address, pid_t bus_pid, { size_t len = strlen (argv[remaining_args+i-1])+1; args[i] = malloc (len); - if (!args[i]) + if (!args[i]) { + while (i > 1) + free(args[--i]); goto oom; + } strncpy (args[i], argv[remaining_args+i-1], len); } args[i] = NULL; -- 1.7.9.5