ensure we never get null from malloc

This commit is contained in:
geeksville 2020-06-13 08:27:25 -07:00
parent 47e614c7d6
commit db66e4dc00

View File

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