mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-11-04 05:15:22 +00:00 
			
		
		
		
	clang compiler warnings: Fix sometimes-initialized warning in func_math
This patch fixes a bug in a unit test in func_math where a variable could be passed to ast_free that wasn't allocated. This patch corrects the issue and ensures that we only attempt to free a variable if we previously allocated it. Review: https://reviewboard.asterisk.org/r/4552 ASTERISK-24917 Reported by: dkdegroot patches: rb4552.patch submitted by dkdegroot (License 6600) ........ Merged revisions 434190 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 434191 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@434192 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		@@ -482,13 +482,11 @@ AST_TEST_DEFINE(test_MATH_function)
 | 
			
		||||
 | 
			
		||||
	ast_test_status_update(test, "Testing MATH() substitution ...\n");
 | 
			
		||||
 | 
			
		||||
	if (!(expr = ast_str_create(16)) || !(result = ast_str_create(16))) {
 | 
			
		||||
		if (expr) {
 | 
			
		||||
			ast_free(expr);
 | 
			
		||||
		}
 | 
			
		||||
		if (result) {
 | 
			
		||||
			ast_free(result);
 | 
			
		||||
		}
 | 
			
		||||
	if (!(expr = ast_str_create(16))) {
 | 
			
		||||
		return AST_TEST_FAIL;
 | 
			
		||||
	}
 | 
			
		||||
	if (!(result = ast_str_create(16))) {
 | 
			
		||||
		ast_free(expr);
 | 
			
		||||
		return AST_TEST_FAIL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user