Merge pull request #16997 from poettering/foreach-word-followup

fix two coverity issues
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2020-09-09 22:00:27 +02:00
committed by GitHub
2 changed files with 5 additions and 4 deletions

View File

@@ -1064,7 +1064,7 @@ static void socket_apply_socket_options(Socket *s, int fd) {
}
if (s->send_buffer > 0) {
r = fd_set_sndbuf(fd, s->receive_buffer, false);
r = fd_set_sndbuf(fd, s->send_buffer, false);
if (r < 0)
log_unit_warning_errno(UNIT(s), r, "SO_SNDBUF/SO_SNDBUFFORCE failed: %m");
}

View File

@@ -916,14 +916,14 @@ _public_ int sd_machine_get_ifindices(const char *machine, int **ret_ifindices)
if (!tt)
return -ENOMEM;
size_t n = 0;
int *ifindices;
_cleanup_free_ int *ifindices = NULL;
if (ret_ifindices) {
ifindices = new(int, strv_length(tt));
if (!ifindices)
return -ENOMEM;
}
size_t n = 0;
for (size_t i = 0; tt[i]; i++) {
int ind;
@@ -938,7 +938,8 @@ _public_ int sd_machine_get_ifindices(const char *machine, int **ret_ifindices)
}
if (ret_ifindices)
*ret_ifindices = ifindices;
*ret_ifindices = TAKE_PTR(ifindices);
return n;
}