Changeset 294daf49 in rtems


Ignore:
Timestamp:
Nov 26, 2003, 5:53:41 PM (16 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Children:
4db3958b
Parents:
c11ca814
Message:

2003-11-26 Joel Sherrill <joel@…>

PR 524/filesystem

  • src/newlibc.c: Address 1K buffer leak from incomplete cleanup of newlib reentrancy handler.
Location:
cpukit/libcsupport
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/ChangeLog

    rc11ca814 r294daf49  
     12003-11-26      Joel Sherrill <joel@OARcorp.com>
     2
     3        PR 524/filesystem
     4        * src/newlibc.c: Address 1K buffer leak from incomplete cleanup of
     5        newlib reentrancy handler.
     6
    172003-11-26      Joel Sherrill <joel@OARcorp.com>
    28
  • cpukit/libcsupport/src/newlibc.c

    rc11ca814 r294daf49  
    4242 
    4343#include <stdio.h>
     44
     45int _fwalk(struct _reent *ptr, int (*function) (FILE *) );
    4446
    4547int              libc_reentrant;        /* do we think we are reentrant? */
     
    197199 */
    198200
     201int newlib_free_buffers(
     202  FILE *fp
     203)
     204{
     205  switch ( fileno(fp) ) {
     206    case 0:
     207    case 1:
     208    case 2:
     209      if (fp->_flags & __SMBF) {
     210        free( fp->_bf._base );
     211        fp->_flags &= ~__SMBF;
     212        fp->_bf._base = fp->_p = (unsigned char *) NULL;
     213      }
     214      break;
     215    default:
     216     fclose(fp);
     217  }
     218  return 0;
     219}
     220
    199221rtems_extension libc_delete_hook(
    200222  rtems_tcb *current_task,
     
    216238  /* if (ptr) */
    217239  if (ptr && ptr != &libc_global_reent) {
     240/*
    218241    _wrapup_reent(ptr);
    219242    _reclaim_reent(ptr);
     243*/
     244    /*
     245     *  Just in case there are some buffers lying around.
     246     */
     247    _fwalk(ptr, newlib_free_buffers);
    220248#if REENT_MALLOCED
    221249    free(ptr);
Note: See TracChangeset for help on using the changeset viewer.