From 715a384c84960487c76f2de29dbcfd90d99a0afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Plewa?= Date: Tue, 10 Jun 2025 15:16:35 +0200 Subject: [PATCH] fix error handling in examples --- examples/cuda_shared_memory/cuda_shared_memory.c | 4 ++-- examples/level_zero_shared_memory/level_zero_shared_memory.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/cuda_shared_memory/cuda_shared_memory.c b/examples/cuda_shared_memory/cuda_shared_memory.c index 50c8f9240..883297edb 100644 --- a/examples/cuda_shared_memory/cuda_shared_memory.c +++ b/examples/cuda_shared_memory/cuda_shared_memory.c @@ -1,6 +1,6 @@ /* * - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception @@ -146,7 +146,7 @@ int main(void) { // Allocate some memory from the pool int *ptr = umfPoolMalloc(cu_disjoint_memory_pool, sizeof(int)); - if (res != UMF_RESULT_SUCCESS) { + if (ptr == NULL) { fprintf(stderr, "Failed to allocate memory from the memory pool!\n"); ret = -1; goto memory_pool_destroy; diff --git a/examples/level_zero_shared_memory/level_zero_shared_memory.c b/examples/level_zero_shared_memory/level_zero_shared_memory.c index 7cfe89366..605f239f8 100644 --- a/examples/level_zero_shared_memory/level_zero_shared_memory.c +++ b/examples/level_zero_shared_memory/level_zero_shared_memory.c @@ -157,7 +157,7 @@ int main(void) { // Allocate some memory from the pool int *ptr = umfPoolMalloc(ze_disjoint_memory_pool, sizeof(int)); - if (res != UMF_RESULT_SUCCESS) { + if (ptr == NULL) { fprintf(stderr, "Failed to allocate memory from the memory pool!\n"); ret = -1; goto memory_pool_destroy;