[svn-commits] dlee: branch dlee/stasis-http r380647 - in /team/dlee/stasis-http: res/ tests/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jan 31 11:01:06 CST 2013


Author: dlee
Date: Thu Jan 31 11:01:03 2013
New Revision: 380647

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=380647
Log:
Fixed errors found by valgrind

Modified:
    team/dlee/stasis-http/res/res_json.c
    team/dlee/stasis-http/tests/test_json.c

Modified: team/dlee/stasis-http/res/res_json.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/res_json.c?view=diff&rev=380647&r1=380646&r2=380647
==============================================================================
--- team/dlee/stasis-http/res/res_json.c (original)
+++ team/dlee/stasis-http/res/res_json.c Thu Jan 31 11:01:03 2013
@@ -398,7 +398,10 @@
 }
 int ast_json_dump_new_file(struct ast_json *root, const char *path)
 {
-	return json_dump_file((json_t *)root, path, dump_flags());
+	if (root && path) {
+		return json_dump_file((json_t *)root, path, dump_flags());
+	}
+	return -1;
 }
 
 /*!

Modified: team/dlee/stasis-http/tests/test_json.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/tests/test_json.c?view=diff&rev=380647&r1=380646&r2=380647
==============================================================================
--- team/dlee/stasis-http/tests/test_json.c (original)
+++ team/dlee/stasis-http/tests/test_json.c Thu Jan 31 11:01:03 2013
@@ -1545,7 +1545,7 @@
 	/* circular reference testing */
 	/* Cannot add self */
 	uut = ast_json_object_create();
-	uut_res = ast_json_object_set(uut, "myself", uut);
+	uut_res = ast_json_object_set(uut, "myself", ast_json_ref(uut));
 	ast_test_validate(test, -1 == uut_res);
 	ast_test_validate(test, 0 == ast_json_object_size(uut));
 
@@ -1570,7 +1570,8 @@
 	}
 
 	uut = ast_json_array_create();
-	uut_res = ast_json_object_set(uut, "myself", uut);
+	ast_test_validate(test, 0 == ast_json_array_size(uut));
+	uut_res = ast_json_array_append(uut, ast_json_ref(uut));
 	ast_test_validate(test, -1 == uut_res);
 	ast_test_validate(test, 0 == ast_json_array_size(uut));
 




More information about the svn-commits mailing list