nasa-jpl/jsd

Do not NULL error_out on empty circular queue poll

alex-brinkman opened this issue · 0 comments

    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)