summaryrefslogtreecommitdiff
path: root/gdb/ser-unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/ser-unix.c')
-rw-r--r--gdb/ser-unix.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c
index f2d9ca607c0..3f0a79a5a2f 100644
--- a/gdb/ser-unix.c
+++ b/gdb/ser-unix.c
@@ -178,9 +178,7 @@ set_tty_state (struct serial *scb, struct hardwire_ttystate *state)
static serial_ttystate
hardwire_get_tty_state (struct serial *scb)
{
- struct hardwire_ttystate *state;
-
- state = (struct hardwire_ttystate *) xmalloc (sizeof *state);
+ struct hardwire_ttystate *state = XNEW (struct hardwire_ttystate);
if (get_tty_state (scb, state))
{
@@ -194,9 +192,8 @@ hardwire_get_tty_state (struct serial *scb)
static serial_ttystate
hardwire_copy_tty_state (struct serial *scb, serial_ttystate ttystate)
{
- struct hardwire_ttystate *state;
+ struct hardwire_ttystate *state = XNEW (struct hardwire_ttystate);
- state = (struct hardwire_ttystate *) xmalloc (sizeof *state);
*state = *(struct hardwire_ttystate *) ttystate;
return (serial_ttystate) state;