talloc asserts

Change-Id: I00df6e41f38eba6b6f06a0dab52035f446718a99
diff --git a/sysmoOCTSIM/talloc.c b/sysmoOCTSIM/talloc.c
index c5c9062..918cf42 100644
--- a/sysmoOCTSIM/talloc.c
+++ b/sysmoOCTSIM/talloc.c
@@ -30,6 +30,10 @@
   inspired by http://swapped.cc/halloc/
 */
 
+#include <parts.h>
+#include <assert.h>
+#include <osmocom/core/utils.h>
+
 #include "replace.h"
 #include "talloc.h"
 
@@ -727,6 +731,9 @@
 	size_t total_len = TC_HDR_SIZE + size + prefix_len;
 	struct talloc_chunk *parent = NULL;
 
+	// do not allocate while handling interrupts!
+	OSMO_ASSERT( !(SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) )
+
 	if (unlikely(context == NULL)) {
 		context = null_context;
 	}
@@ -1740,6 +1747,9 @@
 {
 	struct talloc_chunk *tc;
 
+	// do not deallocate while handling interrupts!
+	OSMO_ASSERT( !(SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) )
+
 	if (unlikely(ptr == NULL)) {
 		return -1;
 	}