[asterisk-commits] eliel: branch group/data_api_gsoc2009 r205667 - in /team/group/data_api_gsoc2...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jul 9 15:11:09 CDT 2009
Author: eliel
Date: Thu Jul 9 15:11:06 2009
New Revision: 205667
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205667
Log:
Avoid unreferencing a null pointer.
Add more search examples.
Modified:
team/group/data_api_gsoc2009/main/data.c
team/group/data_api_gsoc2009/tests/test_data.c
Modified: team/group/data_api_gsoc2009/main/data.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/main/data.c?view=diff&rev=205667&r1=205666&r2=205667
==============================================================================
--- team/group/data_api_gsoc2009/main/data.c (original)
+++ team/group/data_api_gsoc2009/main/data.c Thu Jul 9 15:11:06 2009
@@ -1272,7 +1272,9 @@
search_child = data_search_find(search->children, provider->name);
}
generated = __data_result_generate_node(query, provider, provider->name, flist, search_child);
- ao2_ref(search_child, -1);
+ if (search_child) {
+ ao2_ref(search_child, -1);
+ }
if (generated) {
pathtmp = data_filter_get_last_leaf(provider->name);
@@ -1366,7 +1368,9 @@
ao2_ref(provider_child, -1);
- ao2_ref(search_child, -1);
+ if (search_child) {
+ ao2_ref(search_child, -1);
+ }
if (search) {
data_search_release(search);
Modified: team/group/data_api_gsoc2009/tests/test_data.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/tests/test_data.c?view=diff&rev=205667&r1=205666&r2=205667
==============================================================================
--- team/group/data_api_gsoc2009/tests/test_data.c (original)
+++ team/group/data_api_gsoc2009/tests/test_data.c Thu Jul 9 15:11:06 2009
@@ -44,12 +44,22 @@
{
struct ast_data *res, *internal;
- if (!ast_data_search_cmp_sint(search, "root_test/data1", 10)) {
- ast_debug(1, "root_test/data1 doesn't match\n");
- }
-
- if (!ast_data_search_cmp_sint(search, "root_test/data2", 20)) {
- ast_debug(1, "root_test/data2 doesn't match\n");
+ if (ast_data_search_cmp_sint(search, "root_test/data1", 10)) {
+ ast_log(LOG_ERROR, "root_test/data1 doesn't match\n");
+ } else {
+ ast_log(LOG_ERROR, "root_test/data1 match!\n");
+ }
+
+ if (ast_data_search_cmp_sint(search, "root_test/data2", 20)) {
+ ast_log(LOG_ERROR, "root_test/data2 doesn't match\n");
+ } else {
+ ast_log(LOG_ERROR, "root_test/data2 match!\n");
+ }
+
+ if (ast_data_search_cmp_string(search, "root_test/name", "eliel")) {
+ ast_log(LOG_ERROR, "root_test/data2 doesn't match\n");
+ } else {
+ ast_log(LOG_ERROR, "root_test/data2 match!\n");
}
res = ast_data_create("root_test");
@@ -162,7 +172,9 @@
}
/* get the tree and check for errors. */
+ ast_cli(a->fd, "path = %s\nsearch = %s\n", query.path, query.search);
ast_cli(a->fd, "Getting tree... ");
+
res = ast_data_get(&query);
if (res) {
ast_cli(a->fd, "OK\n");
More information about the asterisk-commits
mailing list