[asterisk-commits] mjordan: trunk r434192 - in /trunk: ./ funcs/func_math.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 6 21:10:33 CDT 2015


Author: mjordan
Date: Mon Apr  6 21:10:31 2015
New Revision: 434192

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=434192
Log:
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

Modified:
    trunk/   (props changed)
    trunk/funcs/func_math.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Modified: trunk/funcs/func_math.c
URL: http://svnview.digium.com/svn/asterisk/trunk/funcs/func_math.c?view=diff&rev=434192&r1=434191&r2=434192
==============================================================================
--- trunk/funcs/func_math.c (original)
+++ trunk/funcs/func_math.c Mon Apr  6 21:10:31 2015
@@ -482,13 +482,11 @@
 
 	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;
 	}
 




More information about the asterisk-commits mailing list