mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-01 17:06:51 +00:00
replace malloc with calloc
malloc: allocate a block of memory, the contents of the block are undefined. calloc: allocate a block of memory for an array of num elements and initializes all its bits to zero. Signed-off-by: yechunliang <yechunliangcn@163.com>
This commit is contained in:
@@ -118,7 +118,7 @@ vm_open(const char *name)
|
||||
int error, retry = 10;
|
||||
uuid_t vm_uuid;
|
||||
|
||||
ctx = malloc(sizeof(struct vmctx) + strlen(name) + 1);
|
||||
ctx = calloc(1, sizeof(struct vmctx) + strlen(name) + 1);
|
||||
assert(ctx != NULL);
|
||||
assert(devfd == -1);
|
||||
|
||||
|
Reference in New Issue
Block a user