SWDEV-357246 - Fixes to return with a error code instead of segfault in alloc failure case

Change-Id: Ie18d50f2f7ef3f4b2c0153152fca057232c1f8a2
This commit is contained in:
Sourabh Betigeri
2022-09-26 22:40:28 -07:00
کامیت شده توسط Maneesh Gupta
والد 47a29c748a
کامیت aeeab1c975
2فایلهای تغییر یافته به همراه14 افزوده شده و 5 حذف شده
+3
مشاهده پرونده
@@ -226,6 +226,9 @@ hipError_t ihipMallocManaged(void** ptr, size_t size, unsigned int align) {
}
size_t offset = 0; //this is ignored
amd::Memory* memObj = getMemoryObject(*ptr, offset);
if (memObj == nullptr) {
return hipErrorMemoryAllocation;
}
//saves the current device id so that it can be accessed later
memObj->getUserData().deviceId = hip::getCurrentDevice()->deviceId();