From c244e8b5a359a6baa2dc6633a40b6b25488afc58 Mon Sep 17 00:00:00 2001 From: Jason Chen CJ Date: Fri, 9 Mar 2018 23:16:08 +0800 Subject: [PATCH] vpic: use calloc to init vpic instead of malloc vpic struct should be init as 0 Signed-off-by: Jason Chen CJ --- hypervisor/arch/x86/guest/vpic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypervisor/arch/x86/guest/vpic.c b/hypervisor/arch/x86/guest/vpic.c index 4c487fc4c..9aa9fe9f1 100644 --- a/hypervisor/arch/x86/guest/vpic.c +++ b/hypervisor/arch/x86/guest/vpic.c @@ -930,7 +930,7 @@ void *vpic_init(struct vm *vm) vpic_register_io_handler(vm); - vpic = malloc(sizeof(struct vpic)); + vpic = calloc(1, sizeof(struct vpic)); ASSERT(vpic != NULL, ""); vpic->vm = vm; vpic->pic[0].mask = 0xff;