example: Initialize volume memory pool
Avoid uninitialized memory access. Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
93b6ddb8a7
commit
0ede30d552
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright(c) 2019-2021 Intel Corporation
|
* Copyright(c) 2019-2022 Intel Corporation
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* 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->name = ocf_uuid_to_str(uuid);
|
||||||
myvolume->mem = malloc(VOL_SIZE);
|
myvolume->mem = malloc(VOL_SIZE);
|
||||||
|
if (!myvolume->mem)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
memset(myvolume->mem, 0, VOL_SIZE);
|
||||||
|
|
||||||
printf("VOL OPEN: (name: %s)\n", myvolume->name);
|
printf("VOL OPEN: (name: %s)\n", myvolume->name);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user