Changeset 459ebc8 in rtems


Ignore:
Timestamp:
Nov 11, 2015, 1:47:50 PM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
06ef76e3
Parents:
b84a51c
git-author:
Sebastian Huber <sebastian.huber@…> (11/11/15 13:47:50)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/12/15 07:28:45)
Message:

libtests/termios04: Avoid use of freed memory

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/libtests/termios04/termios_testdriver_intr.c

    rb84a51c r459ebc8  
    182182)
    183183{
    184   rtems_status_code status;
    185 
    186184  rtems_termios_initialize();
    187185
     
    191189  (void) rtems_io_register_name( TERMIOS_TEST_DRIVER_DEVICE_NAME, major, 0 );
    192190
     191  return RTEMS_SUCCESSFUL;
     192}
     193
     194static int first_open(int major, int minor, void *arg)
     195{
     196  rtems_status_code status;
     197
    193198  status = rtems_timer_create(rtems_build_name('T', 'M', 'R', 'X'), &Rx_Timer);
    194   if ( status )
     199  if ( status != RTEMS_SUCCESSFUL )
    195200    rtems_fatal_error_occurred(1);
    196201
    197202  status = rtems_timer_create(rtems_build_name('T', 'M', 'T', 'X'), &Tx_Timer);
    198   if ( status )
    199     rtems_fatal_error_occurred(1);
    200 
    201   return RTEMS_SUCCESSFUL;
     203  if ( status != RTEMS_SUCCESSFUL )
     204    rtems_fatal_error_occurred(1);
     205
     206  return 0;
     207}
     208
     209static int last_close(int major, int minor, void *arg)
     210{
     211  rtems_status_code status;
     212
     213  status = rtems_timer_cancel(Rx_Timer);
     214  if ( status != RTEMS_SUCCESSFUL )
     215    rtems_fatal_error_occurred(1);
     216
     217  status = rtems_timer_cancel(Tx_Timer);
     218  if ( status != RTEMS_SUCCESSFUL )
     219    rtems_fatal_error_occurred(1);
     220
     221  status = rtems_timer_delete(Rx_Timer);
     222  if ( status != RTEMS_SUCCESSFUL )
     223    rtems_fatal_error_occurred(1);
     224
     225  status = rtems_timer_delete(Tx_Timer);
     226  if ( status != RTEMS_SUCCESSFUL )
     227    rtems_fatal_error_occurred(1);
     228
     229  return 0;
    202230}
    203231
     
    211239  rtems_libio_open_close_args_t *args = arg;
    212240  static const rtems_termios_callbacks Callbacks = {
    213     NULL,                                    /* firstOpen */
    214     NULL,                                    /* lastClose */
     241    first_open,                              /* firstOpen */
     242    last_close,                              /* lastClose */
    215243    #if defined(TASK_DRIVEN)
    216244      termios_test_driver_inbyte_nonblocking,/* pollRead */
Note: See TracChangeset for help on using the changeset viewer.