Replace some xmalloc-family functions with XNEW-family ones
[deliverable/binutils-gdb.git] / gdb / ser-unix.c
index f2d9ca607c0a105d4f9a19b4e28b8df53b161385..3f0a79a5a2fc9457eed6c1fa69eecd15a09b197e 100644 (file)
@@ -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;
This page took 0.038892 seconds and 4 git commands to generate.