mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-21 20:51:00 +00:00
ensure we never get null from malloc
This commit is contained in:
parent
47e614c7d6
commit
db66e4dc00
@ -65,9 +65,13 @@ template <class T> class MemoryDynamic : public Allocator<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Return a queable object which has been prefilled with zeros - allow timeout to wait for available buffers (you
|
// Alloc some storage
|
||||||
/// probably don't want this version).
|
virtual T *alloc(TickType_t maxWait)
|
||||||
virtual T *alloc(TickType_t maxWait) { return (T *)malloc(sizeof(T)); }
|
{
|
||||||
|
T *p = (T *)malloc(sizeof(T));
|
||||||
|
assert(p);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user