Changeset 577c4080 in rtems


Ignore:
Timestamp:
May 17, 1999, 3:28:52 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
a238cc9
Parents:
9e7d42dd
Message:

Patch from D. V. Henkel-Wallace <gumby@…>:

Here's a tiny patch that shreds memory returned to the pool (such as by
free() and delete). This may help people find some nasty
bugs, so here it is.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/rtems/src/region.c

    r9e7d42dd r577c4080  
    1313 *  $Id$
    1414 */
     15
     16#ifdef RTEMS_REGION_FREE_SHRED_PATTERN
     17#include <string.h>
     18#endif
    1519
    1620#include <rtems/system.h>
     
    451455  Objects_Locations        location;
    452456  void                   **the_segment;
     457#ifdef RTEMS_SHRED_ON_FREE
     458  unsigned32               size;
     459#endif
    453460  int                      status;
    454461
     
    465472
    466473      _Region_Debug_Walk( the_region, 3 );
     474
     475#ifdef RTEMS_REGION_FREE_SHRED_PATTERN
     476      if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) {
     477        memset(segment, (RTEMS_REGION_FREE_SHRED_BYTE & 0xFF), size);
     478      } else {
     479        _Thread_Enable_dispatch();
     480        return RTEMS_INVALID_ADDRESS;
     481      }
     482#endif
    467483
    468484      status = _Region_Free_segment( the_region, segment );
  • cpukit/rtems/src/region.c

    r9e7d42dd r577c4080  
    1313 *  $Id$
    1414 */
     15
     16#ifdef RTEMS_REGION_FREE_SHRED_PATTERN
     17#include <string.h>
     18#endif
    1519
    1620#include <rtems/system.h>
     
    451455  Objects_Locations        location;
    452456  void                   **the_segment;
     457#ifdef RTEMS_SHRED_ON_FREE
     458  unsigned32               size;
     459#endif
    453460  int                      status;
    454461
     
    465472
    466473      _Region_Debug_Walk( the_region, 3 );
     474
     475#ifdef RTEMS_REGION_FREE_SHRED_PATTERN
     476      if ( _Heap_Size_of_user_area( &the_region->Memory, segment, size ) ) {
     477        memset(segment, (RTEMS_REGION_FREE_SHRED_BYTE & 0xFF), size);
     478      } else {
     479        _Thread_Enable_dispatch();
     480        return RTEMS_INVALID_ADDRESS;
     481      }
     482#endif
    467483
    468484      status = _Region_Free_segment( the_region, segment );
Note: See TracChangeset for help on using the changeset viewer.