Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ring_buffer actual capacity ? #124

Closed
giltho opened this issue Nov 17, 2019 · 0 comments · Fixed by #125
Closed

ring_buffer actual capacity ? #124

giltho opened this issue Nov 17, 2019 · 0 comments · Fixed by #125

Comments

@giltho
Copy link
Contributor

giltho commented Nov 17, 2019

Hello,

I think there is an issue with the ring buffer capacity. The buffer is allocated in the following way :

ringbuf->buf = rconf->mem_calloc(rconf->capacity, sizeof(Rbuf))

I am pretty sure it should be sizeof(uint64_t) instead. Right now, for a ring buffer of capacity 10, insteda of allocating 80 bytes, it allocates 640 bytes !
It is also possible to call rbuf_peek(rbuf, 79) on a ring buffer of capacity 10.

If I am right, I'll happily submit a PR to fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant