Fix file descriptor leak in error path.

This commit is contained in:
Milan Broz
2019-02-07 17:37:16 +01:00
parent 91b74b6896
commit 2b8b43b3db

View File

@@ -166,10 +166,12 @@ int crypt_wipe_device(struct crypt_device *cd,
else {
r = device_size(device, &dev_size);
if (r)
return r;
goto out;
if (dev_size <= offset)
return -EINVAL;
if (dev_size <= offset) {
r = -EINVAL;
goto out;
}
}
r = posix_memalign((void **)&sf, alignment, wipe_block_size);