If the call to mmap_full_file() at the beginning of decode_key() fails,
we return without initializing the result pointer to NULL. This does not
matter now, because the only caller of decode_key() does not look at the
pointer value in the error case. Let's be defensive here and initialize
the pointer anyway.
ret = mmap_full_file(key_file, O_RDONLY, &map, &map_size, NULL);
if (ret < 0)
- return ret;
+ goto out;
ret = -E_KEY_MARKER;
if (strncmp(map, header_str, strlen(header_str)))
goto unmap;
free(blob);
blob = NULL;
}
+out:
*result = blob;
return ret;
}