summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2015-11-24 10:17:59 +0000
committerMarc Espie <espie@cvs.openbsd.org>2015-11-24 10:17:59 +0000
commit9ebadf1ad3c550a3fdf976878e9fde81b3675591 (patch)
tree3032c5fe99249be574d1c3b41d07bd3801afebd7 /usr.sbin
parent33efc4faa93971fe8b54500c72d6b3f81c096f35 (diff)
realloc* is designed so that NULL pointer = malloc. Ditch redundant code
okay reyk@ mlarkin@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/vmmctl/vmmctl.c18
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++;