We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I encountered a dangling pointer problem in the function r_utils_linklist_pop when I implemented the project.
r_utils_linklist_pop
void* r_utils_list_pop(r_utils_linklist_s *l) { r_utils_linklist_cell_s *c; void *elem; assert(l != NULL); if(l->head == NULL) return NULL; c = l->tail; elem = c->elem; l->tail = c->prev; if(l->tail == NULL) l->head = NULL; free(c); l->num--; return elem; }
And I think I should set l->tail->next = NULL if l->tail != NULL when I pop an element.
if (l->tail == NULL) l->head = NULL; else l->tail->next = NULL;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I encountered a dangling pointer problem in the function
r_utils_linklist_pop
when I implemented the project.And I think I should set l->tail->next = NULL if l->tail != NULL when I pop an element.
The text was updated successfully, but these errors were encountered: