aboutsummaryrefslogtreecommitdiffstats
path: root/res
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 /res
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 'res')
-rw-r--r--res/res_musiconhold.c4
-rw-r--r--res/res_phoneprov.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index 1eb8d10df..d8fc58d4a 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -1586,7 +1586,6 @@ static char *handle_cli_moh_show_files(struct ast_cli_entry *e, int cmd, struct
return CLI_SHOWUSAGE;
i = ao2_iterator_init(mohclasses, 0);
-
for (; (class = ao2_iterator_next(&i)); mohclass_unref(class)) {
int x;
@@ -1599,6 +1598,7 @@ static char *handle_cli_moh_show_files(struct ast_cli_entry *e, int cmd, struct
ast_cli(a->fd, "\tFile: %s\n", class->filearray[x]);
}
}
+ ao2_iterator_destroy(&i);
return CLI_SUCCESS;
}
@@ -1623,7 +1623,6 @@ static char *handle_cli_moh_show_classes(struct ast_cli_entry *e, int cmd, struc
return CLI_SHOWUSAGE;
i = ao2_iterator_init(mohclasses, 0);
-
for (; (class = ao2_iterator_next(&i)); mohclass_unref(class)) {
ast_cli(a->fd, "Class: %s\n", class->name);
ast_cli(a->fd, "\tMode: %s\n", S_OR(class->mode, "<none>"));
@@ -1635,6 +1634,7 @@ static char *handle_cli_moh_show_classes(struct ast_cli_entry *e, int cmd, struc
ast_cli(a->fd, "\tFormat: %s\n", ast_getformatname(class->format));
}
}
+ ao2_iterator_destroy(&i);
return CLI_SUCCESS;
}
diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c
index 9ef5a1ac4..0cc054a45 100644
--- a/res/res_phoneprov.c
+++ b/res/res_phoneprov.c
@@ -891,6 +891,7 @@ static void delete_routes(void)
ao2_unlink(http_routes, route);
route = unref_route(route);
}
+ ao2_iterator_destroy(&i);
}
/*! \brief Delete all phone profiles, freeing their memory */
@@ -904,6 +905,7 @@ static void delete_profiles(void)
ao2_unlink(profiles, profile);
profile = unref_profile(profile);
}
+ ao2_iterator_destroy(&i);
}
/*! \brief A dialplan function that can be used to print a string for each phoneprov user */
@@ -974,6 +976,7 @@ static char *handle_show_routes(struct ast_cli_entry *e, int cmd, struct ast_cli
ast_cli(a->fd, FORMAT, route->uri, route->file->template);
route = unref_route(route);
}
+ ao2_iterator_destroy(&i);
ast_cli(a->fd, "\nDynamic routes\n\n");
ast_cli(a->fd, FORMAT, "Relative URI", "Template");
@@ -984,6 +987,7 @@ static char *handle_show_routes(struct ast_cli_entry *e, int cmd, struct ast_cli
ast_cli(a->fd, FORMAT, route->uri, route->file->template);
route = unref_route(route);
}
+ ao2_iterator_destroy(&i);
return CLI_SUCCESS;
}