mirror of
https://salsa.debian.org/ha-team/libqb
synced 2026-01-02 22:07:21 +00:00
lib: Fix some small bugs spotted by newest covscan (#471)
* lib: Fix some small bugs spotted by newest covscan
This commit is contained in:
parent
14507d538d
commit
eaa95ecf03
@ -183,6 +183,7 @@ dgram_verify_msg_size(size_t max_msg_size)
|
||||
int32_t write_passed = 0;
|
||||
int32_t read_passed = 0;
|
||||
char buf[max_msg_size];
|
||||
memset (buf, 0, max_msg_size);
|
||||
|
||||
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sockets) < 0) {
|
||||
qb_util_perror(LOG_DEBUG, "error calling socketpair()");
|
||||
|
||||
@ -705,7 +705,7 @@ _process_request_(struct qb_ipcs_connection *c, int32_t ms_timeout)
|
||||
}
|
||||
}
|
||||
|
||||
if (c && c->service->funcs.peek && c->service->funcs.reclaim) {
|
||||
if (c->service->funcs.peek && c->service->funcs.reclaim) {
|
||||
c->service->funcs.reclaim(&c->request);
|
||||
}
|
||||
|
||||
@ -748,6 +748,11 @@ qb_ipcs_dispatch_connection_request(int32_t fd, int32_t revents, void *data)
|
||||
int32_t recvd = 0;
|
||||
ssize_t avail;
|
||||
|
||||
if (c == NULL) {
|
||||
res = -EINVAL;
|
||||
goto dispatch_cleanup;
|
||||
}
|
||||
|
||||
if (revents & POLLNVAL) {
|
||||
qb_util_log(LOG_DEBUG, "NVAL conn (%s)", c->description);
|
||||
res = -EINVAL;
|
||||
|
||||
@ -264,6 +264,9 @@ qb_log_blackbox_print_from_file(const char *bb_filename)
|
||||
return -EIO;
|
||||
}
|
||||
chunk = malloc(max_size);
|
||||
if (!chunk) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
do {
|
||||
char *ptr;
|
||||
@ -342,7 +345,7 @@ qb_log_blackbox_print_from_file(const char *bb_filename)
|
||||
int slen = strftime(time_buf,
|
||||
sizeof(time_buf), "%b %d %T",
|
||||
tm);
|
||||
snprintf(time_buf+slen, sizeof(time_buf - slen), ".%03llu", timestamp.tv_nsec/QB_TIME_NS_IN_MSEC);
|
||||
snprintf(time_buf+slen, sizeof(time_buf) - slen, ".%03llu", timestamp.tv_nsec/QB_TIME_NS_IN_MSEC);
|
||||
} else {
|
||||
snprintf(time_buf, sizeof(time_buf), "%ld",
|
||||
(long int)time_sec);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user