Skip to content

Commit 715a384

Browse files
lplewabratpiorka
authored andcommitted
fix error handling in examples
1 parent 46fafe4 commit 715a384

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

examples/cuda_shared_memory/cuda_shared_memory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2024 Intel Corporation
3+
* Copyright (C) 2024-2025 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
@@ -146,7 +146,7 @@ int main(void) {
146146

147147
// Allocate some memory from the pool
148148
int *ptr = umfPoolMalloc(cu_disjoint_memory_pool, sizeof(int));
149-
if (res != UMF_RESULT_SUCCESS) {
149+
if (ptr == NULL) {
150150
fprintf(stderr, "Failed to allocate memory from the memory pool!\n");
151151
ret = -1;
152152
goto memory_pool_destroy;

examples/level_zero_shared_memory/level_zero_shared_memory.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ int main(void) {
157157

158158
// Allocate some memory from the pool
159159
int *ptr = umfPoolMalloc(ze_disjoint_memory_pool, sizeof(int));
160-
if (res != UMF_RESULT_SUCCESS) {
160+
if (ptr == NULL) {
161161
fprintf(stderr, "Failed to allocate memory from the memory pool!\n");
162162
ret = -1;
163163
goto memory_pool_destroy;

0 commit comments

Comments
 (0)