diff --git a/example/simple/src/main.c b/example/simple/src/main.c index 9b23ec8..a644ff2 100644 --- a/example/simple/src/main.c +++ b/example/simple/src/main.c @@ -161,6 +161,8 @@ int initialize_cache(ocf_ctx_t ctx, ocf_cache_t *cache) if (ret) goto err_cache; + ocf_volume_destroy(volume); + return 0; err_cache: diff --git a/example/simple/src/volume.c b/example/simple/src/volume.c index 52585a4..5fe8597 100644 --- a/example/simple/src/volume.c +++ b/example/simple/src/volume.c @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019-2021 Intel Corporation + * Copyright(c) 2019-2022 Intel Corporation * SPDX-License-Identifier: BSD-3-Clause */ @@ -21,6 +21,10 @@ static int volume_open(ocf_volume_t volume, void *volume_params) myvolume->name = ocf_uuid_to_str(uuid); myvolume->mem = malloc(VOL_SIZE); + if (!myvolume->mem) + return -ENOMEM; + + memset(myvolume->mem, 0, VOL_SIZE); printf("VOL OPEN: (name: %s)\n", myvolume->name);