summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/util/util.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/util/util.c b/lib/util/util.c
index c0af4b0116..076ddf47fc 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -899,8 +899,13 @@ void *allocate_anonymous_shared(size_t bufsz)
void samba_start_debugger(void)
{
char *cmd = NULL;
- asprintf(&cmd, "xterm -e \"gdb --pid %u\"&", getpid());
- system(cmd);
+ if (asprintf(&cmd, "xterm -e \"gdb --pid %u\"&", getpid()) == -1) {
+ return;
+ }
+ if (system(cmd) == -1) {
+ free(cmd);
+ return;
+ }
free(cmd);
sleep(2);
}