mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
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: https://origsvn.digium.com/svn/asterisk/trunk@141995 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1464,18 +1464,22 @@ static int load_module(void)
|
|||||||
|
|
||||||
static int unload_module(void)
|
static int unload_module(void)
|
||||||
{
|
{
|
||||||
struct chan_oss_pvt *o;
|
struct chan_oss_pvt *o, *next;
|
||||||
|
|
||||||
ast_channel_unregister(&oss_tech);
|
ast_channel_unregister(&oss_tech);
|
||||||
ast_cli_unregister_multiple(cli_oss, sizeof(cli_oss) / sizeof(struct ast_cli_entry));
|
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);
|
close(o->sounddev);
|
||||||
if (o->owner)
|
if (o->owner)
|
||||||
ast_softhangup(o->owner, AST_SOFTHANGUP_APPUNLOAD);
|
ast_softhangup(o->owner, AST_SOFTHANGUP_APPUNLOAD);
|
||||||
if (o->owner) /* XXX how ??? */
|
if (o->owner) /* XXX how ??? */
|
||||||
return -1;
|
return -1;
|
||||||
/* XXX what about the memory allocated ? */
|
next = o->next;
|
||||||
|
ast_free(o->name);
|
||||||
|
ast_free(o);
|
||||||
|
o = next;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user