com php-src: Fix a few valgrind warnings with undefing result: Zend/zend_execute.c Zend/zend_vm_def.h Zend/zend _vm_execute.h
| From: | Bob Weinand | Date: | Thu, 01 Dec 2016 09:15:07 +0000 |
| Subject: | com php-src: Fix a few valgrind warnings with undefing result: Zend/zend_execute.c Zend/zend_vm_def.h Zend/zend _vm_execute.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96120@lists.php.net to get a copy of this message | ||
Commit: 8f4e100f21b06e745e56f55ce49c248442f8e642
Author: Bob Weinand <bobwei9@hotmail.com> Thu, 1 Dec 2016 10:15:07 +0100
Parents: bb78637bda1414d771c1d508ad27b8ca413888b8
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8f4e100f21b06e745e56f55ce49c248442f8e642
Log:
Fix a few valgrind warnings with undefing result
Changed paths:
M Zend/zend_execute.c
M Zend/zend_vm_def.h
M Zend/zend_vm_execute.h
Diff:
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 4f692ac..363586d 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1415,7 +1415,9 @@ static zend_never_inline void zend_pre_incdec_overloaded_property(zval
*object,
zptr = z = Z_OBJ_HT(obj)->read_property(&obj, property, BP_VAR_R, cache_slot, &rv);
if (UNEXPECTED(EG(exception))) {
OBJ_RELEASE(Z_OBJ(obj));
- ZVAL_UNDEF(result);
+ if (result) {
+ ZVAL_UNDEF(result);
+ }
return;
}
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 32c2e9b..f12f446 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -893,7 +893,9 @@ ZEND_VM_C_LABEL(assign_dim_op_convert_to_array):
zend_check_string_offset(dim, BP_VAR_RW);
zend_wrong_string_offset();
}
- ZVAL_UNDEF(EX_VAR(opline->result.var));
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
ZEND_VM_C_GOTO(assign_dim_op_convert_to_array);
} else {
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 7feab78..a72f0c9 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -17475,7 +17475,9 @@ assign_dim_op_convert_to_array:
zend_check_string_offset(dim, BP_VAR_RW);
zend_wrong_string_offset();
}
- ZVAL_UNDEF(EX_VAR(opline->result.var));
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
} else {
@@ -20890,7 +20892,9 @@ assign_dim_op_convert_to_array:
zend_check_string_offset(dim, BP_VAR_RW);
zend_wrong_string_offset();
}
- ZVAL_UNDEF(EX_VAR(opline->result.var));
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
} else {
@@ -22256,7 +22260,9 @@ assign_dim_op_convert_to_array:
zend_check_string_offset(dim, BP_VAR_RW);
zend_wrong_string_offset();
}
- ZVAL_UNDEF(EX_VAR(opline->result.var));
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
} else {
@@ -25198,7 +25204,9 @@ assign_dim_op_convert_to_array:
zend_check_string_offset(dim, BP_VAR_RW);
zend_wrong_string_offset();
}
- ZVAL_UNDEF(EX_VAR(opline->result.var));
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
} else {
@@ -36860,7 +36868,9 @@ assign_dim_op_convert_to_array:
zend_check_string_offset(dim, BP_VAR_RW);
zend_wrong_string_offset();
}
- ZVAL_UNDEF(EX_VAR(opline->result.var));
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
} else {
@@ -41450,7 +41460,9 @@ assign_dim_op_convert_to_array:
zend_check_string_offset(dim, BP_VAR_RW);
zend_wrong_string_offset();
}
- ZVAL_UNDEF(EX_VAR(opline->result.var));
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
} else {
@@ -43915,7 +43927,9 @@ assign_dim_op_convert_to_array:
zend_check_string_offset(dim, BP_VAR_RW);
zend_wrong_string_offset();
}
- ZVAL_UNDEF(EX_VAR(opline->result.var));
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
} else {
@@ -47983,7 +47997,9 @@ assign_dim_op_convert_to_array:
zend_check_string_offset(dim, BP_VAR_RW);
zend_wrong_string_offset();
}
- ZVAL_UNDEF(EX_VAR(opline->result.var));
+ if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
+ ZVAL_UNDEF(EX_VAR(opline->result.var));
+ }
} else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
goto assign_dim_op_convert_to_array;
} else {