Fix some cppcheck warnings.

Despite it is nonsense and cppcheck should understand the code better :-)
This commit is contained in:
Milan Broz
2018-12-04 12:30:14 +01:00
parent 9cbd36163c
commit 3ea8e01a9d
3 changed files with 9 additions and 3 deletions

View File

@@ -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);