summaryrefslogtreecommitdiffstats
path: root/smart.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2008-07-01 13:46:40 +0200
committerLennart Poettering <lennart@poettering.net>2008-07-01 13:46:40 +0200
commit50985d78c0372994c0a60f04b289dc7fdc5b66ed (patch)
tree73c782533878ae3849bc89a9a15770d2570757ed /smart.c
parentcde75bd31b5493f5f912331a88061d30a34cd746 (diff)
fix fail path
Diffstat (limited to 'smart.c')
-rw-r--r--smart.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/smart.c b/smart.c
index 4cd9322..9d8a530 100644
--- a/smart.c
+++ b/smart.c
@@ -1176,12 +1176,12 @@ int sk_disk_open(const char *name, SkDisk **_d) {
if (!(d = calloc(1, sizeof(SkDisk)))) {
errno = ENOMEM;
- return -1;
+ goto fail;
}
if (!(d->name = strdup(name))) {
errno = ENOMEM;
- return -1;
+ goto fail;
}
if ((d->fd = open(name, O_RDWR|O_NOCTTY)) < 0) {
@@ -1194,6 +1194,7 @@ int sk_disk_open(const char *name, SkDisk **_d) {
if (!S_ISBLK(st.st_mode)) {
errno = ENODEV;
+ ret = -1;
goto fail;
}
@@ -1204,6 +1205,7 @@ int sk_disk_open(const char *name, SkDisk **_d) {
if (d->size <= 0 || d->size == (uint64_t) -1) {
errno = EIO;
+ ret = -1;
goto fail;
}