Changeset 7d1436e in rtems


Ignore:
Timestamp:
May 6, 2014, 11:41:28 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
c2ea0ea
Parents:
4d906bda
git-author:
Sebastian Huber <sebastian.huber@…> (05/06/14 11:41:28)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/06/14 11:46:20)
Message:

posix: Fix POSIX keys initialization

Always initialize the freechain. This prevents a NULL pointer access in
case no initial key value pairs are defined.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/posix/src/key.c

    r4d906bda r7d1436e  
    113113static void _POSIX_Keys_Initialize_keypool( void )
    114114{
     115  Freechain_Control *keypool = &_POSIX_Keys_Keypool;
    115116  size_t initial_count = _POSIX_Keys_Get_initial_keypool_size();
    116   size_t size = initial_count * sizeof( POSIX_Keys_Key_value_pair );
    117117
    118   if ( size > 0 ) {
    119     Freechain_Control *keypool = &_POSIX_Keys_Keypool;
     118  _Freechain_Initialize( keypool, _POSIX_Keys_Keypool_extend );
     119
     120  if ( initial_count > 0 ) {
     121    size_t size = initial_count * sizeof( POSIX_Keys_Key_value_pair );
    120122    POSIX_Keys_Key_value_pair *nodes =
    121123      _Workspace_Allocate_or_fatal_error( size );
    122 
    123     _Freechain_Initialize( keypool, _POSIX_Keys_Keypool_extend );
    124124
    125125    _Chain_Initialize(
Note: See TracChangeset for help on using the changeset viewer.