diff options
author | pjd <pjd@FreeBSD.org> | 2007-05-01 23:33:12 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2007-05-01 23:33:12 +0000 |
commit | 40cd52d5581515f402756a317c99a655fbdbe632 (patch) | |
tree | e0acc6c88acec5a849fd1839f437224b32c9c983 | |
parent | 0eb08efde0d7110cfbf7aaa6244e42e64e44e357 (diff) | |
download | FreeBSD-src-40cd52d5581515f402756a317c99a655fbdbe632.zip FreeBSD-src-40cd52d5581515f402756a317c99a655fbdbe632.tar.gz |
Do some cleanups (like freeing memory and closing file descriptors) before
leaving the functions.
-rw-r--r-- | sbin/geom/class/eli/geom_eli.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/geom/class/eli/geom_eli.c b/sbin/geom/class/eli/geom_eli.c index 3bf4fdc..ea2bbae 100644 --- a/sbin/geom/class/eli/geom_eli.c +++ b/sbin/geom/class/eli/geom_eli.c @@ -1053,7 +1053,7 @@ eli_backup(struct gctl_req *req) } if (provfd == -1) { gctl_error(req, "Cannot open %s: %s.", prov, strerror(errno)); - return; + goto out; } filefd = open(file, O_WRONLY | O_TRUNC | O_CREAT, 0600); if (filefd == -1) { @@ -1066,13 +1066,13 @@ eli_backup(struct gctl_req *req) if (mediasize == 0 || secsize == 0) { gctl_error(req, "Cannot get informations about %s: %s.", prov, strerror(errno)); - return; + goto out; } sector = malloc(secsize); if (sector == NULL) { gctl_error(req, "Cannot allocate memory."); - return; + goto out; } /* Read metadata from the provider. */ @@ -1139,7 +1139,7 @@ eli_restore(struct gctl_req *req) } if (provfd == -1) { gctl_error(req, "Cannot open %s: %s.", prov, strerror(errno)); - return; + goto out; } mediasize = g_get_mediasize(prov); @@ -1147,13 +1147,13 @@ eli_restore(struct gctl_req *req) if (mediasize == 0 || secsize == 0) { gctl_error(req, "Cannot get informations about %s: %s.", prov, strerror(errno)); - return; + goto out; } sector = malloc(secsize); if (sector == NULL) { gctl_error(req, "Cannot allocate memory."); - return; + goto out; } /* Read metadata from the backup file. */ |