If the list is removed during 'for' statement, 'list->next' also set NULL.
Fix the logic to store 'list->next' in advance.
Change-Id: Iae4bb280f68d770b0528bbc5b9bbd38fb88f4884
BT_INFO("+");
/* Get method invocation context */
- for (l = _bt_get_invocation_list(); l != NULL; l = g_slist_next(l)) {
+ for (l = _bt_get_invocation_list(); l != NULL; ) {
req_info = l->data;
+ l = g_slist_next(l);
if (req_info == NULL || req_info->service_function != service_function)
continue;
BT_INFO("+");
/* Get method invocation context */
- for (l = _bt_get_invocation_list(); l != NULL; l = g_slist_next(l)) {
+ for (l = _bt_get_invocation_list(); l != NULL; ) {
req_info = l->data;
+ l = g_slist_next(l);
if (req_info == NULL || req_info->service_function != service_function)
continue;
BT_DBG("+");
/* Get method invocation context */
- for (l = _bt_get_invocation_list(); l != NULL; l = g_slist_next(l)) {
+ for (l = _bt_get_invocation_list(); l != NULL; ) {
req_info = l->data;
+ l = g_slist_next(l);
if (req_info == NULL || req_info->service_function != service_function)
continue;
BT_DBG("+");
/* Get method invocation context */
- for (l = _bt_get_invocation_list(); l != NULL; l = g_slist_next(l)) {
+ for (l = _bt_get_invocation_list(); l != NULL; ) {
req_info = l->data;
+ l = g_slist_next(l);
if (req_info == NULL || req_info->service_function != service_function)
continue;
BT_DBG("+");
/* Get method invocation context */
- for (l = _bt_get_invocation_list(); l != NULL; l = g_slist_next(l)) {
+ for (l = _bt_get_invocation_list(); l != NULL; ) {
req_info = l->data;
+ l = g_slist_next(l);
if (req_info == NULL || req_info->service_function != service_function)
continue;
ret_if(data == NULL);
BT_DBG("+");
- for (l = _bt_get_invocation_list(); l != NULL; l = g_slist_next(l)) {
+ for (l = _bt_get_invocation_list(); l != NULL; ) {
req_info = l->data;
+ l = g_slist_next(l);
if (req_info == NULL || req_info->service_function != service_function)
continue;
BT_DBG("+");
- for (l = _bt_get_invocation_list(); l != NULL; l = g_slist_next(l)) {
+ for (l = _bt_get_invocation_list(); l != NULL; ) {
req_info = l->data;
+ l = g_slist_next(l);
if (req_info == NULL || req_info->service_function != service_function)
continue;