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

switch_xml_unbind_search_function_ptr function node delete error #1770

Open
langyalian opened this issue Aug 24, 2022 · 0 comments
Open

switch_xml_unbind_search_function_ptr function node delete error #1770

langyalian opened this issue Aug 24, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@langyalian
Copy link

Describe the bug
The last node should not be moved when deleting a node

SWITCH_DECLARE(switch_status_t) switch_xml_unbind_search_function_ptr(switch_xml_search_function_t function)
{
	switch_xml_binding_t *ptr, *last = NULL;
	switch_status_t status = SWITCH_STATUS_FALSE;

	switch_thread_rwlock_wrlock(B_RWLOCK);
	for (ptr = BINDINGS; ptr; ptr = ptr->next) {
		if (ptr->function == function) {
			status = SWITCH_STATUS_SUCCESS;

			if (last) {
				last->next = ptr->next;
                                /* Add */
				continue;
			} else {
				BINDINGS = ptr->next;
				last = NULL;
				continue;
			}
		}
		last = ptr;
	}
	switch_thread_rwlock_unlock(B_RWLOCK);

	return status;
}
@langyalian langyalian added the bug Something isn't working label Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant