Browse code

core: at shutdown, first call the destroy module functions then free module exports structure

- some modules may need access to other modules at shut down
- reported by Juha Heinanen

Daniel-Constantin Mierla authored on 16/11/2011 06:50:42
Showing 1 changed files
... ...
@@ -775,12 +775,19 @@ void destroy_modules()
775 775
 {
776 776
 	struct sr_module* t, *foo;
777 777
 
778
+	/* call first destroy function from each module */
778 779
 	t=modules;
779 780
 	while(t) {
780 781
 		foo=t->next;
781 782
 		if (t->exports.destroy_f){
782 783
 			t->exports.destroy_f();
783 784
 		}
785
+		t=foo;
786
+	}
787
+	/* free module exports structures */
788
+	t=modules;
789
+	while(t) {
790
+		foo=t->next;
784 791
 		pkg_free(t);
785 792
 		t=foo;
786 793
 	}