summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-06 13:52:25 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-06 13:52:25 +0200
commit648a5df4ce33488120bf97b56b2b7d5ef12028ce (patch)
treec8093d27e85d3b54ace5ceea4e67b1a863a0b6ce /cpukit/libcsupport
parentmalloc: Fix early realloc() allocation (diff)
downloadrtems-648a5df4ce33488120bf97b56b2b7d5ef12028ce.tar.bz2
malloc: Avoid memory leaks during task delete
Call _Malloc_Process_deferred_frees() owning the allocator lock to prevent deletion of the executing thread while doing the deferred frees.
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r--cpukit/libcsupport/src/malloc_deferred.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cpukit/libcsupport/src/malloc_deferred.c b/cpukit/libcsupport/src/malloc_deferred.c
index 977ec7b3f6..962ae3e81f 100644
--- a/cpukit/libcsupport/src/malloc_deferred.c
+++ b/cpukit/libcsupport/src/malloc_deferred.c
@@ -86,13 +86,15 @@ void *rtems_heap_allocate_aligned_with_boundary(
switch ( _Malloc_System_state() ) {
case MALLOC_SYSTEM_STATE_NORMAL:
+ _RTEMS_Lock_allocator();
_Malloc_Process_deferred_frees();
- p = _Protected_heap_Allocate_aligned_with_boundary(
+ p = _Heap_Allocate_aligned_with_boundary(
heap,
size,
alignment,
boundary
);
+ _RTEMS_Unlock_allocator();
break;
case MALLOC_SYSTEM_STATE_NO_PROTECTION:
p = _Heap_Allocate_aligned_with_boundary(