mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-22 15:20:39 +01:00
[poincare] Handle allocation failure in TreePool::deepCopy
This commit is contained in:
@@ -42,6 +42,10 @@ public:
|
||||
TreeNode * deepCopy(TreeNode * node) {
|
||||
size_t size = node->deepSize();
|
||||
void * ptr = alloc(size);
|
||||
if (ptr == nullptr) {
|
||||
node->failedAllocationStaticNode()->retain();
|
||||
return node->failedAllocationStaticNode();
|
||||
}
|
||||
memcpy(ptr, static_cast<void *>(node), size);
|
||||
TreeNode * copy = reinterpret_cast<TreeNode *>(ptr);
|
||||
renameNode(copy);
|
||||
|
||||
Reference in New Issue
Block a user