Commit 4bcba41d authored by Milan Broz's avatar Milan Broz

Fix crypt_init(cd, NULL) case in the previous commit.

parent 12040570
......@@ -246,15 +246,17 @@ int device_alloc(struct device **device, const char *path)
if (r < 0)
return r;
r = device_ready(dev);
if (!r) {
dev->init_done = 1;
} else if (r == -ENOTBLK) {
/* alloc loop later */
} else if (r < 0) {
free(dev->path);
free(dev);
return -ENOTBLK;
if (dev) {
r = device_ready(dev);
if (!r) {
dev->init_done = 1;
} else if (r == -ENOTBLK) {
/* alloc loop later */
} else if (r < 0) {
free(dev->path);
free(dev);
return -ENOTBLK;
}
}
*device = dev;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment