mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 11:50:10 +01:00
Fix some cppcheck warnings.
Despite it is nonsense and cppcheck should understand the code better :-)
This commit is contained in:
@@ -1222,7 +1222,8 @@ int LUKS2_config_get_flags(struct crypt_device *cd, struct luks2_hdr *hdr, uint3
|
||||
|
||||
for (i = 0; i < (int) json_object_array_length(jobj_flags); i++) {
|
||||
jobj1 = json_object_array_get_idx(jobj_flags, i);
|
||||
for (j = 0, found = 0; persistent_flags[j].description && !found; j++)
|
||||
found = 0;
|
||||
for (j = 0; persistent_flags[j].description && !found; j++)
|
||||
if (!strcmp(persistent_flags[j].description,
|
||||
json_object_get_string(jobj1))) {
|
||||
*flags |= persistent_flags[j].flag;
|
||||
|
||||
@@ -226,7 +226,8 @@ int VERITY_UUID_generate(struct crypt_device *cd, char **uuid_string)
|
||||
{
|
||||
uuid_t uuid;
|
||||
|
||||
if (!(*uuid_string = malloc(40)))
|
||||
*uuid_string = malloc(40);
|
||||
if (!*uuid_string)
|
||||
return -ENOMEM;
|
||||
uuid_generate(uuid);
|
||||
uuid_unparse(uuid, *uuid_string);
|
||||
|
||||
@@ -303,7 +303,11 @@ static int create_empty_header(const char *new_file, const char *old_file,
|
||||
|
||||
log_dbg("Creating empty file %s of size %lu.", new_file, (unsigned long)size);
|
||||
|
||||
if (!size || !(buf = malloc(size)))
|
||||
if (!size)
|
||||
return -EINVAL;
|
||||
|
||||
buf = malloc(size);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
memset(buf, 0, size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user