mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-15 05:49:17 +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:
@@ -1105,9 +1105,8 @@ vrtc_init(struct vmctx *ctx, int local_time)
|
||||
time_t curtime;
|
||||
struct inout_port rtc_addr, rtc_data;
|
||||
|
||||
vrtc = malloc(sizeof(struct vrtc));
|
||||
vrtc = calloc(1, sizeof(struct vrtc));
|
||||
assert(vrtc != NULL);
|
||||
memset(vrtc, 0, sizeof(struct vrtc));
|
||||
vrtc->vm = ctx;
|
||||
ctx->vrtc = vrtc;
|
||||
|
||||
|
Reference in New Issue
Block a user