Skip to content

Commit bdc7160

Browse files
authored
Some bugs spotted by coverity (#399)
1 parent 803d924 commit bdc7160

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

include/tlist.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static inline void timerlist_expire(struct timerlist *timerlist)
191191
uint64_t current_time;
192192

193193
current_monotonic_time = qb_util_nano_current_get();
194-
current_time_from_epoch = current_time = qb_util_nano_from_epoch_get();
194+
current_time_from_epoch = qb_util_nano_from_epoch_get();
195195

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

lib/ringbuffer.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,13 @@ qb_rb_open_2(const char *name, size_t size, uint32_t flags,
266266
if (fd_hdr >= 0) {
267267
close(fd_hdr);
268268
}
269-
if (rb && (flags & QB_RB_FLAG_CREATE)) {
269+
if (rb && (rb->shared_hdr != MAP_FAILED) && (flags & QB_RB_FLAG_CREATE)) {
270270
unlink(rb->shared_hdr->hdr_path);
271271
if (rb->notifier.destroy_fn) {
272272
(void)rb->notifier.destroy_fn(rb->notifier.instance);
273273
}
274274
}
275-
if (rb && (rb->shared_hdr != MAP_FAILED && rb->shared_hdr != NULL)) {
275+
if (rb && (rb->shared_hdr != MAP_FAILED)) {
276276
munmap(rb->shared_hdr, sizeof(struct qb_ringbuffer_shared_s));
277277
}
278278
free(rb);

0 commit comments

Comments
 (0)