Skip to content

Commit f1135be

Browse files
authored
Merge pull request #72 from amcamd/mem_leak
return error if handle is nullptr
2 parents fcd8801 + 2ab231b commit f1135be

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

library/include/hipblas.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ enum hipblasStatus_t {
3030
HIPBLAS_STATUS_EXECUTION_FAILED = 5, // GPU program failed to execute
3131
HIPBLAS_STATUS_INTERNAL_ERROR = 6, // an internal HIPBLAS operation failed
3232
HIPBLAS_STATUS_NOT_SUPPORTED = 7, // function not implemented
33-
HIPBLAS_STATUS_ARCH_MISMATCH = 8
33+
HIPBLAS_STATUS_ARCH_MISMATCH = 8,
34+
HIPBLAS_STATUS_HANDLE_IS_NULLPTR = 9 // hipBLAS handle is null pointer
3435
};
3536

3637
// set the values of enum constants to be the same as those used in cblas

library/src/hcc_detail/hipblas.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ hipblasStatus_t hipblasCreate(hipblasHandle_t* handle)
265265

266266
if (handle == nullptr)
267267
{
268-
handle = (hipblasHandle_t *) new rocblas_handle();
268+
return HIPBLAS_STATUS_HANDLE_IS_NULLPTR;
269269
}
270270

271271
err = hipGetDevice(&deviceId);

0 commit comments

Comments
 (0)