[rtems commit] malloc: Avoid memory leaks during task delete
Sebastian Huber
sebh at rtems.org
Wed Apr 6 11:54:27 UTC 2016
Module: rtems
Branch: master
Commit: 648a5df4ce33488120bf97b56b2b7d5ef12028ce
Changeset: http://git.rtems.org/rtems/commit/?id=648a5df4ce33488120bf97b56b2b7d5ef12028ce
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Apr 6 13:52:25 2016 +0200
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.
---
cpukit/libcsupport/src/malloc_deferred.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/cpukit/libcsupport/src/malloc_deferred.c b/cpukit/libcsupport/src/malloc_deferred.c
index 977ec7b..962ae3e 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(
More information about the vc
mailing list