misc: address sanitizer: fix instrumentation

Type: fix

Change-Id: I99e3951f8cfb7ab9d2f0a7dcee92199eab29043c
Signed-off-by: Benoît Ganne <bganne@cisco.com>
diff --git a/src/vppinfra/dlmalloc.c b/src/vppinfra/dlmalloc.c
index 451666e..13f0dff 100644
--- a/src/vppinfra/dlmalloc.c
+++ b/src/vppinfra/dlmalloc.c
@@ -4139,6 +4139,7 @@
   return 0;
 }
 
+CLIB_NOSANITIZE_ADDR
 void *mspace_least_addr (mspace msp)
 {
   mstate ms = (mstate) msp;
@@ -4152,6 +4153,7 @@
   disable_expand (ms);
 }
 
+CLIB_NOSANITIZE_ADDR
 int mspace_enable_disable_trace (mspace msp, int enable)
 {
   mstate ms = (mstate)msp;
diff --git a/src/vppinfra/mem_dlmalloc.c b/src/vppinfra/mem_dlmalloc.c
index 5628e27..68901a5 100644
--- a/src/vppinfra/mem_dlmalloc.c
+++ b/src/vppinfra/mem_dlmalloc.c
@@ -215,12 +215,13 @@
   else
     heap = create_mspace (memory_size, 1 /* locked */ );
 
+  CLIB_MEM_POISON (mspace_least_addr (heap), mspace_footprint (heap));
+
   clib_mem_set_heap (heap);
 
   if (mheap_trace_main.lock == 0)
     clib_spinlock_init (&mheap_trace_main.lock);
 
-  CLIB_MEM_POISON (mspace_least_addr (heap), mspace_footprint (heap));
   return heap;
 }