From 273d3d6b7e8e85b4b2a9618bf2af134594830c38 Mon Sep 17 00:00:00 2001 From: scipio Date: Tue, 24 Jul 2007 18:15:31 +0000 Subject: [PATCH] Fixed remove bug noted by J. Ryan Stinnett. --- tos/lib/tossim/sim_gain.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tos/lib/tossim/sim_gain.c b/tos/lib/tossim/sim_gain.c index cb64571c..1d3ad795 100644 --- a/tos/lib/tossim/sim_gain.c +++ b/tos/lib/tossim/sim_gain.c @@ -101,6 +101,7 @@ void sim_gain_remove(int src, int dest) __attribute__ ((C, spontaneous)) { prevLink = NULL; while (current != NULL) { + gain_entry_t* tmp; if (current->mote == dest) { if (prevLink == NULL) { connectivity[src] = current->next; @@ -108,8 +109,9 @@ void sim_gain_remove(int src, int dest) __attribute__ ((C, spontaneous)) { else { prevLink->next = current->next; } + tmp = current->next; sim_gain_deallocate_link(current); - current = prevLink->next; + current = tmp; } else { prevLink = current; -- 2.39.2