[sr-dev] git:3.2: core: at shutdown, first call the destroy module functions then free module exports structure

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 22 12:16:13 CET 2011


Module: sip-router
Branch: 3.2
Commit: d3408c64b6c07806a51e1e72589f8e124c8c651c
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d3408c64b6c07806a51e1e72589f8e124c8c651c

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Wed Nov 16 07:50:42 2011 +0100

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
(cherry picked from commit 2396dde7230e04f853e6936cfff9059661c55635)

---

 sr_module.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/sr_module.c b/sr_module.c
index 564900c..7b0d85d 100644
--- a/sr_module.c
+++ b/sr_module.c
@@ -775,12 +775,19 @@ void destroy_modules()
 {
 	struct sr_module* t, *foo;
 
+	/* call first destroy function from each module */
 	t=modules;
 	while(t) {
 		foo=t->next;
 		if (t->exports.destroy_f){
 			t->exports.destroy_f();
 		}
+		t=foo;
+	}
+	/* free module exports structures */
+	t=modules;
+	while(t) {
+		foo=t->next;
 		pkg_free(t);
 		t=foo;
 	}




More information about the sr-dev mailing list