On a failure of jent_read_entropy() where the entropy collector will be reallocated, jent_entropy_collector_free() is used to release ec, but ec is not set to NULL. If a failure occurs in the following call to jent_entropy_collector_ex() then the function will return with a dangling pointer remaining in ec. Set ec to NULL after freeing to prevent this.
On a failure of jent_read_entropy() where the entropy collector will be reallocated, jent_entropy_collector_free() is used to release ec, but ec is not set to NULL. If a failure occurs in the following call to jent_entropy_collector_ex() then the function will return with a dangling pointer remaining in ec. Set ec to NULL after freeing to prevent this.