diff --git a/src/rm_allocator.c b/src/rm_allocator.c
index b36dd37a657d495d4fb11b2466886b6ac0a9b31c..0e74966c6ff6aabc5be411b2f543da058517a518 100644 (file)
--- a/src/rm_allocator.c
+++ b/src/rm_allocator.c
@@ -386,6 +386,7 @@ static int32_t allocatorPreAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator,
Rm_Inst *rmInst = (Rm_Inst *)rmHandle;
Rm_ResourceNode findNode;
Rm_ResourceNode *matchingNode = NULL;
+ Rm_ResourceNode *nextNode;
uint32_t matchingEnd;
uint32_t findEnd;
uint32_t rangeIndex;
@@ -509,7 +510,12 @@ static int32_t allocatorPreAllocate(Rm_Handle rmHandle, Rm_Allocator *allocator,
findNode.base = matchingNode->base;
}
else {
- findNode.base = matchingNode->base + matchingNode->length;
+ if (nextNode = RB_NEXT(_Rm_AllocatorResourceTree, allocator->allocatorRootEntry, matchingNode)) {
+ findNode.base = nextNode->base;
+ }
+ else {
+ retVal = RM_SERVICE_DENIED_RES_ALLOC_REQS_NOT_MET;
+ }
}
}
}
Rm_Inst *rmInst = (Rm_Inst *)rmHandle;
void * policy = rmPolicyGetPolicy((Rm_Handle)rmInst);
int32_t resOffsetInPolicy = rmPolicyGetResourceOffset(policy, resourceName);
- uint32_t allocSize = rmPolicyGetResourceAllocSize(policy, resOffsetInPolicy);
+ uint32_t allocSize = rmPolicyGetResourceCdAllocSize(policy, resOffsetInPolicy);
Rm_Allocator *allocator = rmAllocatorFind(rmHandle, resourceName);
Rm_ResourceNode findNode;
Rm_ResourceNode *matchingNode = NULL;