From 277474eea03e0f77a9d37c69dfab3f0c41812348 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 25 Jun 2020 14:44:13 -0400 Subject: gdb: make inferior::terminal a unique ptr This changes the inferior::terminal field to be a unique pointer, so its deallocation is automatically managed. gdb/ChangeLog: * inferior.h (struct inferior) : Change type to gdb::unique_xmalloc_ptr. * inferior.c (inferior::~inferior): Don't free inf->terminal. * infcmd.c (set_inferior_io_terminal): Don't free terminal field, adjust to unique pointer. (get_inferior_io_terminal): Adjust to unique pointer. Change-Id: Iedb6459b4f9eeae812b0cb9d514b5707d5107cdb --- gdb/inferior.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gdb/inferior.h') diff --git a/gdb/inferior.h b/gdb/inferior.h index 95af474..5002b0b 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -52,6 +52,7 @@ struct thread_info; #include "symfile-add-flags.h" #include "gdbsupport/refcounted-object.h" #include "gdbsupport/forward-scope-exit.h" +#include "gdbsupport/gdb_unique_ptr.h" #include "gdbsupport/common-inferior.h" #include "gdbthread.h" @@ -456,7 +457,7 @@ public: gdb::unique_xmalloc_ptr cwd; /* The name of terminal device to use for I/O. */ - char *terminal = NULL; + gdb::unique_xmalloc_ptr terminal; /* The terminal state as set by the last target_terminal::terminal_* call. */ -- cgit v1.1