Changeset 7307d943 in rtems


Ignore:
Timestamp:
Oct 16, 2001, 8:52:57 PM (19 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Children:
7f62220
Parents:
fda19968
Message:

2001-10-11 Mike Siers <mikes@…>

  • libc/termios.c: Fixed a memory leak in the termios software. Basically the tty open function was allocating an input raw buffer, an output raw buffer, and a cooked buffer that were not getting released. I have attached a patch for the latest snapshot. The patch also has a fix to ensure the tty link list is updated correctly when a tty is closed.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libc/termios.c

    rfda19968 r7307d943  
    325325                if (tty->device.lastClose)
    326326                         (*tty->device.lastClose)(tty->major, tty->minor, arg);
    327                 if (tty->forw == NULL)
     327                if (tty->forw == NULL) {
    328328                        rtems_termios_ttyTail = tty->back;
    329                 else
     329                        if ( rtems_termios_ttyTail != NULL ) {
     330                                rtems_termios_ttyTail->forw = NULL;
     331                        }
     332                }
     333                else {
    330334                        tty->forw->back = tty->back;
    331                 if (tty->back == NULL)
     335                }
     336                if (tty->back == NULL) {
    332337                        rtems_termios_ttyHead = tty->forw;
    333                 else
     338                        if ( rtems_termios_ttyHead != NULL ) {
     339                                rtems_termios_ttyHead->back = NULL;
     340                        }
     341                }
     342                else {
    334343                        tty->back->forw = tty->forw;
     344                }
    335345                rtems_semaphore_delete (tty->isem);
    336346                rtems_semaphore_delete (tty->osem);
     
    338348                if (!tty->device.pollRead)
    339349                        rtems_semaphore_delete (tty->rawInBufSemaphore);
     350                free (tty->cbuf);
    340351                free (tty);
    341352        }
Note: See TracChangeset for help on using the changeset viewer.