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

Do not NULL error_out on empty circular queue poll #54

Open
alex-brinkman opened this issue Oct 26, 2022 · 0 comments
Open

Do not NULL error_out on empty circular queue poll #54

alex-brinkman opened this issue Oct 26, 2022 · 0 comments

Comments

@alex-brinkman
Copy link
Contributor

    I do not think NULL should be used as an indication of an empty queue. There are only two possible outcomes of this function and they are already handled by the boolean return value: 1) an element is retrieved so the function returns `true`, or 2) the queue is empty so the function returns `false`.

This is to be safe with the interface. If for whatever reason a dynamically allocated error_out is passed and the queue is empty, you could have a memory leak if you set the pointer to NULL.

Originally posted by @d-loret in #46 (comment)

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

No branches or pull requests

1 participant