diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-03-25 23:49:13 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-03-25 23:49:13 +0100 |
commit | 608d41f355d580a6f73e76b298bfc1b4e3155b80 (patch) | |
tree | a774752fe8cac1934cdc0d9da3ac46b2682c95aa /src/cryptsetup/cryptsetup-generator.c | |
parent | 6a7d3d68bf1ae9bcdaa3a17bc76f72bb7b988ec4 (diff) |
cryptsetup-generator: add a missing OOM check
Diffstat (limited to 'src/cryptsetup/cryptsetup-generator.c')
-rw-r--r-- | src/cryptsetup/cryptsetup-generator.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c index 0a51db8939..5c4a2807a7 100644 --- a/src/cryptsetup/cryptsetup-generator.c +++ b/src/cryptsetup/cryptsetup-generator.c @@ -169,8 +169,6 @@ static int create_disk( } free(to); - to = NULL; - if (!nofail) to = strjoin(arg_dest, "/cryptsetup.target.requires/", n, NULL); else @@ -183,12 +181,13 @@ static int create_disk( log_error("Failed to create symlink '%s' to '%s': %m", from, to); return -errno; } - - free(to); - to = NULL; } e = unit_name_escape(name); + if (!e) + return log_oom(); + + free(to); to = strjoin(arg_dest, "/dev-mapper-", e, ".device.requires/", n, NULL); if (!to) return log_oom(); |