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

Daniel-Constantin Mierla miconda at gmail.com
Wed Nov 16 08:56:24 CET 2011


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

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

---

 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