Changeset 843


Ignore:
Timestamp:
Oct 27, 2003, 9:16:47 AM (22 years ago)
Author:
bird
Message:

#716,#608: Fixed bad defaul heap queries. (calloc() crash if called prior to main().)

Location:
trunk/src/emx/src/lib/malloc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/lib/malloc/calloc.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r842 r843  
    1414{
    1515  _UM_MT_DECL
     16  Heap_t    heap_reg = _UM_DEFAULT_REGULAR_HEAP;
    1617
    17   if (_UM_DEFAULT_REGULAR_HEAP == NULL)
    18     _um_init_default_regular_heap ();
    19   return _ucalloc (_UM_DEFAULT_REGULAR_HEAP, count, size);
     18  if (heap_reg == NULL)
     19    heap_reg = _um_init_default_regular_heap ();
     20  return _ucalloc (heap_reg, count, size);
    2021}
  • trunk/src/emx/src/lib/malloc/heapchk.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r842 r843  
    3535     heap, return the regular heap's status. */
    3636
    37   if (_UM_DEFAULT_REGULAR_HEAP == _UM_DEFAULT_TILED_HEAP
    38       || _UM_DEFAULT_TILED_HEAP == NULL)
     37  if (heap_reg == heap_tiled || heap_tiled == NULL)
    3938    return rc1;
    4039
  • trunk/src/emx/src/lib/malloc/heapset.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r842 r843  
    1515  _UM_MT_DECL
    1616  int rc1, rc2;
     17  Heap_t    heap_reg = _UM_DEFAULT_REGULAR_HEAP;
     18  Heap_t    heap_tiled = _UM_DEFAULT_TILED_HEAP;
    1719
    1820  /* Initialize the heap pointers, in case _heapset() is called by a
     
    2022
    2123  if (_UM_DEFAULT_REGULAR_HEAP == NULL)
    22     _um_init_default_regular_heap ();
     24    heap_reg = _um_init_default_regular_heap ();
    2325  if (_UM_DEFAULT_TILED_HEAP == NULL)
    24     _um_init_default_tiled_heap ();
     26    heap_tiled = _um_init_default_tiled_heap ();
    2527
    2628  /* First fill the regular heap. */
    2729
    28   rc1 = _uheapset (_UM_DEFAULT_REGULAR_HEAP, fill);
     30  rc1 = _uheapset (heap_reg, fill);
    2931  if (rc1 != _HEAPOK && rc1 != _HEAPEMPTY)
    3032    return rc1;
     
    3335     heap, return the regular heap's status. */
    3436
    35   if (_UM_DEFAULT_REGULAR_HEAP == _UM_DEFAULT_TILED_HEAP
    36       || _UM_DEFAULT_TILED_HEAP == NULL)
     37  if (heap_reg == heap_tiled || heap_tiled == NULL)
    3738    return rc1;
    3839
     
    4041     heaps is non-empty. */
    4142
    42   rc2 = _uheapset (_UM_DEFAULT_TILED_HEAP, fill);
     43  rc2 = _uheapset (heap_tiled, fill);
    4344  if (rc2 == _HEAPEMPTY)
    4445    return rc1;
Note: See TracChangeset for help on using the changeset viewer.