aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authortwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-10-15 02:13:17 +0000
committertwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2010-10-15 02:13:17 +0000
commit54eccc4b39db6230e667e1182f9589109fd9a6fe (patch)
treeb308010bd32bdf356d2249e52a2e9c1fdb7062a0 /channels
parent5b6cfe88a8e0bcc3d4b93a0d2ef0be9f7f357fee (diff)
Don't access o->next after freeing o on unload
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@291862 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_oss.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index f78046780..026a63d44 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -1875,12 +1875,13 @@ static int load_module(void)
static int unload_module(void)
{
- struct chan_oss_pvt *o;
+ struct chan_oss_pvt *o, *next;
ast_channel_unregister(&oss_tech);
ast_cli_unregister_multiple(cli_oss, sizeof(cli_oss) / sizeof(struct ast_cli_entry));
- for (o = oss_default.next; o; o = o->next) {
+ o = oss_default.next;
+ while (o) {
if (o->owner) {
ast_softhangup(o->owner, AST_SOFTHANGUP_APPUNLOAD);
/* Give the channel a chance to go away */
@@ -1900,9 +1901,11 @@ static int unload_module(void)
close(o->sndcmd[0]);
close(o->sndcmd[1]);
}
+ next = o->next;
if (o->sthread > 0) {
- free(o);
+ ast_free(o);
}
+ o = next;
}
return 0;
}