]> git.proxmox.com Git - qemu.git/commitdiff
vmdk: share cleanup code
authorJuan Quintela <quintela@redhat.com>
Thu, 4 Mar 2010 09:00:37 +0000 (10:00 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 9 Mar 2010 17:23:00 +0000 (11:23 -0600)
cleanup code is identical for error/success cases.  Only difference
are goto labels.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
block/vmdk.c

index 819c1c9fc5b1bc8a3f9a9d104408fb0ddaa94b03..007fca4c701aba264828e7bdb6be20db69542aaf 100644 (file)
@@ -334,18 +334,13 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file)
         ret = -errno;
         goto fail_gd;
     }
-    qemu_free(gd_buf);
-    qemu_free(rgd_buf);
-
-    close(p_fd);
-    close(snp_fd);
-    return 0;
+    ret = 0;
 
-    fail_gd:
+fail_gd:
     qemu_free(gd_buf);
-    fail_rgd:
+fail_rgd:
     qemu_free(rgd_buf);
-    fail:
+fail:
     close(p_fd);
     close(snp_fd);
     return ret;