From 21f01aaf025a0a699c1fe30c7e198a33ef300d97 Mon Sep 17 00:00:00 2001 From: Oded Gabbay Date: Thu, 19 Mar 2015 10:09:37 +0200 Subject: [PATCH] Fix return value when local memory alloc fails Signed-off-by: Oded Gabbay Reviewed-by: Ben Goz [ROCm/ROCR-Runtime commit: ac56c6baff140c05be0bd7ca4806f192af639ca2] --- projects/rocr-runtime/src/fmm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/rocr-runtime/src/fmm.c b/projects/rocr-runtime/src/fmm.c index 6f5e651054..eacbac070a 100644 --- a/projects/rocr-runtime/src/fmm.c +++ b/projects/rocr-runtime/src/fmm.c @@ -547,6 +547,9 @@ void *fmm_allocate_device(uint32_t gpu_id, uint64_t MemorySizeInBytes) pthread_mutex_lock(&aperture->fmm_mutex); aperture_release_area(aperture, mem, MemorySizeInBytes); pthread_mutex_unlock(&aperture->fmm_mutex); + + /* Assign NULL to mem to indicate failure to calling function */ + mem = NULL; } return mem;