From 8200fccb3fabf1646277575e3fc93bc7b172045b Mon Sep 17 00:00:00 2001 From: Eric Wild Date: Wed, 27 Nov 2019 18:01:44 +0100 Subject: [PATCH] talloc asserts Change-Id: I00df6e41f38eba6b6f06a0dab52035f446718a99 --- sysmoOCTSIM/talloc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 +#include +#include + #include "replace.h" #include "talloc.h" @@ -727,6 +731,9 @@ static inline void *__talloc_with_prefix(const void *context, 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 @@ _PUBLIC_ int _talloc_free(void *ptr, const char *location) { struct talloc_chunk *tc; + // do not deallocate while handling interrupts! + OSMO_ASSERT( !(SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) ) + if (unlikely(ptr == NULL)) { return -1; }