[rtems commit] sptests/spfatal24: Fix NULL pointer access

Sebastian Huber sebh at rtems.org
Thu Nov 15 14:29:48 UTC 2012


Module:    rtems
Branch:    master
Commit:    f48d06a6e1d4faf9d525689320e634ae4fc097d2
Changeset: http://git.rtems.org/rtems/commit/?id=f48d06a6e1d4faf9d525689320e634ae4fc097d2

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Nov 15 15:02:54 2012 +0100

sptests/spfatal24: Fix NULL pointer access

---

 testsuites/sptests/spfatal24/testcase.h |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/testsuites/sptests/spfatal24/testcase.h b/testsuites/sptests/spfatal24/testcase.h
index 0ca1032..6ac8906 100644
--- a/testsuites/sptests/spfatal24/testcase.h
+++ b/testsuites/sptests/spfatal24/testcase.h
@@ -8,6 +8,7 @@
  */
 
 #include <rtems/gxx_wrappers.h>
+#include <rtems/malloc.h>
 
 #define FATAL_ERROR_TEST_NAME            "GXX KEY ADD FAILURE"
 #define FATAL_ERROR_DESCRIPTION          "GXX KEY ADD FAILURE"
@@ -17,16 +18,9 @@
 
 void force_error()
 {
-  void *alloc_ptr = NULL;
-  Heap_Information_block info;
-  __gthread_key_t key = 0;
-  bool ok = false;
+  __gthread_key key;
 
-  ok = rtems_workspace_get_information( &info );
-  rtems_test_assert( ok );
+  rtems_workspace_greedy_allocate( NULL, 0 );
 
-  ok = rtems_workspace_allocate( info.Free.largest - 4, &alloc_ptr );
-  rtems_test_assert( ok );
-
-  rtems_gxx_getspecific( key );
+  rtems_gxx_getspecific( &key );
 }




More information about the vc mailing list