aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_console.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-10-06 01:33:01 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-10-06 01:33:01 +0000
commit28ac723a337536809c6d8f363ff84037a548f690 (patch)
treeb32c9541ad363f4d005d8e98b92952fc366c9b08 /channels/chan_console.c
parenta95870bdebdce6b672ff5bce92d9d3914c7858b0 (diff)
Merged revisions 222176 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r222176 | kpfleming | 2009-10-05 20:24:24 -0500 (Mon, 05 Oct 2009) | 27 lines Recorded merge of revisions 222152 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r222152 | kpfleming | 2009-10-05 20:16:36 -0500 (Mon, 05 Oct 2009) | 20 lines Fix ao2_iterator API to hold references to containers being iterated. See Mantis issue for details of what prompted this change. Additional notes: This patch changes the ao2_iterator API in two ways: F_AO2I_DONTLOCK has become an enum instead of a macro, with a name that fits our naming policy; also, it is now necessary to call ao2_iterator_destroy() on any iterator that has been created. Currently this only releases the reference to the container being iterated, but in the future this could also release other resources used by the iterator, if the iterator implementation changes to use additional resources. (closes issue #15987) Reported by: kpfleming Review: https://reviewboard.asterisk.org/r/383/ ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@222185 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_console.c')
-rw-r--r--channels/chan_console.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/channels/chan_console.c b/channels/chan_console.c
index b3a48a5c5..ab91131c7 100644
--- a/channels/chan_console.c
+++ b/channels/chan_console.c
@@ -1017,6 +1017,7 @@ static char *cli_list_devices(struct ast_cli_entry *e, int cmd, struct ast_cli_a
console_pvt_unlock(pvt);
unref_pvt(pvt);
}
+ ao2_iterator_destroy(&i);
ast_cli(a->fd, "=============================================================\n\n");
@@ -1168,9 +1169,12 @@ static char *cli_console_active(struct ast_cli_entry *e, int cmd, struct ast_cli
if (++x > a->n && !strncasecmp(pvt->name, a->word, strlen(a->word)))
res = ast_strdup(pvt->name);
unref_pvt(pvt);
- if (res)
+ if (res) {
+ ao2_iterator_destroy(&i);
return res;
+ }
}
+ ao2_iterator_destroy(&i);
}
return NULL;
}
@@ -1370,6 +1374,7 @@ static void destroy_pvts(void)
}
unref_pvt(pvt);
}
+ ao2_iterator_destroy(&i);
}
/*!
@@ -1440,6 +1445,7 @@ static void stop_streams(void)
stop_stream(pvt);
unref_pvt(pvt);
}
+ ao2_iterator_destroy(&i);
}
static int unload_module(void)