talloc asserts

Change-Id: I00df6e41f38eba6b6f06a0dab52035f446718a99
This commit is contained in:
Eric Wild 2019-11-27 18:01:44 +01:00
parent e4f90fe4ef
commit 8200fccb3f
1 changed files with 10 additions and 0 deletions

View File

@ -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 @@ 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;
}