Module: sip-router
Branch: 3.1
Commit: 57127690357878a7d66642362506f0aaa865f9b5
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5712769…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)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)
(cherry picked from commit d3408c64b6c07806a51e1e72589f8e124c8c651c)
---
sr_module.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/sr_module.c b/sr_module.c
index db6a95e..28fe0c7 100644
--- a/sr_module.c
+++ b/sr_module.c
@@ -725,12 +725,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;
}