Skip to content

Commit

Permalink
Some bugs spotted by coverity (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrissie-c authored May 28, 2020
1 parent 803d924 commit bdc7160
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/tlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ static inline void timerlist_expire(struct timerlist *timerlist)
uint64_t current_time;

current_monotonic_time = qb_util_nano_current_get();
current_time_from_epoch = current_time = qb_util_nano_from_epoch_get();
current_time_from_epoch = qb_util_nano_from_epoch_get();

qb_list_for_each_safe(pos, next, &timerlist->timer_head) {

Expand Down
4 changes: 2 additions & 2 deletions lib/ringbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,13 @@ qb_rb_open_2(const char *name, size_t size, uint32_t flags,
if (fd_hdr >= 0) {
close(fd_hdr);
}
if (rb && (flags & QB_RB_FLAG_CREATE)) {
if (rb && (rb->shared_hdr != MAP_FAILED) && (flags & QB_RB_FLAG_CREATE)) {
unlink(rb->shared_hdr->hdr_path);
if (rb->notifier.destroy_fn) {
(void)rb->notifier.destroy_fn(rb->notifier.instance);
}
}
if (rb && (rb->shared_hdr != MAP_FAILED && rb->shared_hdr != NULL)) {
if (rb && (rb->shared_hdr != MAP_FAILED)) {
munmap(rb->shared_hdr, sizeof(struct qb_ringbuffer_shared_s));
}
free(rb);
Expand Down

0 comments on commit bdc7160

Please sign in to comment.