Prechádzať zdrojové kódy

- del_nonshm_lump_rpl fixed to delete lumps that are not in shared memory
(this commit is worth two full days of debugging, credits go to Atle
Samuelsen who was helping me with debugging).

Jan Janak 21 rokov pred
rodič
commit
48b79d65fd
1 zmenil súbory, kde vykonal 19 pridanie a 11 odobranie
  1. 19 11
      data_lump_rpl.c

+ 19 - 11
data_lump_rpl.c

@@ -133,17 +133,25 @@ void unlink_lump_rpl(struct sip_msg * msg, struct lump_rpl* lump)
 	}
 }
 
-
-
-void del_nonshm_lump_rpl( struct lump_rpl **head_list)
+void del_nonshm_lump_rpl(struct lump_rpl** list)
 {
-	struct lump_rpl *foo;
-
-	while( (*head_list) && (((*head_list)->flags&LUMP_RPL_SHMEM)==0) ) {
-		foo = (*head_list);
-		(*head_list) = foo->next;
-		free_lump_rpl( foo );
-	}
+        struct lump_rpl* it, *tmp;
+        struct lump_rpl** pred;
+
+        it = *list;
+        pred = list;
+
+        while(it) {
+                if (!(it->flags & LUMP_RPL_SHMEM)) {
+                        tmp = it;
+                        *pred = it->next;
+                        it = it->next;
+                        free_lump_rpl(tmp);
+                        continue;
+                }
+
+                pred = &it->next;
+                it = it->next;
+        }
 }
 
-