Quiet some clang 10 analyzer warnings.

This commit is contained in:
Todd C. Miller
2020-08-07 14:22:56 -06:00
parent 63dadad9df
commit fa5d44b8b5
8 changed files with 46 additions and 38 deletions

View File

@@ -66,7 +66,7 @@ int
linux_audit_command(char *const argv[], int result)
{
int au_fd, rc = -1;
char *command, *cp;
char *cp, *command = NULL;
char * const *av;
size_t size, n;
debug_decl(linux_audit_command, SUDOERS_DEBUG_AUDIT);
@@ -78,7 +78,8 @@ linux_audit_command(char *const argv[], int result)
/* Convert argv to a flat string. */
for (size = 0, av = argv; *av != NULL; av++)
size += strlen(*av) + 1;
command = malloc(size);
if (size != 0)
command = malloc(size);
if (command == NULL) {
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
goto done;