From 9aa236e19f4374a35a6885c6db3225491457fe3a Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Thu, 17 Jun 2010 11:24:01 -0400 Subject: [PATCH] Remove error checking after using vshMalloc. vshMalloc and friends always exit() on allocation failure, so there is no reason to do checking for NULL in the code that uses it. Signed-off-by: Chris Lalancette --- tools/virsh.c | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index c4c02d7283..5bf32dcea8 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1629,8 +1629,6 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd) if (nparams) { params = vshMalloc(ctl, sizeof(virSchedParameter)* nparams); - if (params == NULL) - goto cleanup; memset(params, 0, sizeof(virSchedParameter)* nparams); ret = virDomainGetSchedulerParameters(dom, params, &nparams); @@ -7909,51 +7907,40 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd) /* Make XML of interface */ tmp = vshMalloc(ctl, 1); - if (!tmp) goto cleanup; buf = vshMalloc(ctl, strlen(type) + 25); - if (!buf) goto cleanup; sprintf(buf, " \n" , type); tmp = vshRealloc(ctl, tmp, strlen(source) + 28); - if (!tmp) goto cleanup; if (typ == 1) { sprintf(tmp, " \n", source); } else if (typ == 2) { sprintf(tmp, " \n", source); } buf = vshRealloc(ctl, buf, strlen(buf) + strlen(tmp) + 1); - if (!buf) goto cleanup; strcat(buf, tmp); if (target != NULL) { tmp = vshRealloc(ctl, tmp, strlen(target) + 24); - if (!tmp) goto cleanup; sprintf(tmp, " \n", target); buf = vshRealloc(ctl, buf, strlen(buf) + strlen(tmp) + 1); - if (!buf) goto cleanup; strcat(buf, tmp); } if (mac != NULL) { tmp = vshRealloc(ctl, tmp, strlen(mac) + 25); - if (!tmp) goto cleanup; sprintf(tmp, " \n", mac); buf = vshRealloc(ctl, buf, strlen(buf) + strlen(tmp) + 1); - if (!buf) goto cleanup; strcat(buf, tmp); } if (script != NULL) { tmp = vshRealloc(ctl, tmp, strlen(script) + 25); - if (!tmp) goto cleanup; sprintf(tmp, "