diff options
-rw-r--r-- | usr.sbin/vmmctl/vmmctl.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/usr.sbin/vmmctl/vmmctl.c b/usr.sbin/vmmctl/vmmctl.c index 0a61b6af853..0d32454ab86 100644 --- a/usr.sbin/vmmctl/vmmctl.c +++ b/usr.sbin/vmmctl/vmmctl.c @@ -360,19 +360,11 @@ add_info(struct imsg *imsg, int *ret) static struct vm_info_result *vir = NULL; if (imsg->hdr.type == IMSG_VMDOP_GET_INFO_VM_DATA) { - if (ct == 0) { - vir = malloc(sizeof(struct vm_info_result)); - if (vir == NULL) { - *ret = ENOMEM; - return (1); - } - } else { - vir = reallocarray(vir, ct + 1, - sizeof(struct vm_info_result)); - if (vir == NULL) { - *ret = ENOMEM; - return (1); - } + vir = reallocarray(vir, ct + 1, + sizeof(struct vm_info_result)); + if (vir == NULL) { + *ret = ENOMEM; + return (1); } bcopy(imsg->data, &vir[ct], sizeof(struct vm_info_result)); ct++; |