diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-09-09 10:20:58 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-09-09 10:20:58 +0000 |
commit | 35cda8840d7a20df5075e964f19d8fa82aa26ec5 (patch) | |
tree | 5e8ebdc20407eb3f77f114f442df1d5548f71502 /channels/chan_oss.c | |
parent | 8fa2e42c38d7753f70b5f3b55e90ad75a916b9c6 (diff) |
Fix a memory leak in chan_oss
(closes issue #13311)
Reported by: eliel
Patches:
chan_oss.c.patch uploaded by eliel (license 64)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@141995 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_oss.c')
-rw-r--r-- | channels/chan_oss.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/channels/chan_oss.c b/channels/chan_oss.c index a3908a504..b3c29c031 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -1464,18 +1464,22 @@ 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) { close(o->sounddev); if (o->owner) ast_softhangup(o->owner, AST_SOFTHANGUP_APPUNLOAD); if (o->owner) /* XXX how ??? */ return -1; - /* XXX what about the memory allocated ? */ + next = o->next; + ast_free(o->name); + ast_free(o); + o = next; } return 0; } |