]> granicus.if.org Git - php/commitdiff
Fix a few valgrind warnings with undefing result
authorBob Weinand <bobwei9@hotmail.com>
Thu, 1 Dec 2016 09:15:07 +0000 (10:15 +0100)
committerBob Weinand <bobwei9@hotmail.com>
Thu, 1 Dec 2016 09:15:07 +0000 (10:15 +0100)
Zend/zend_execute.c
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index 4f692ac454f1316cac26747cd5a4f3bec1ee7749..363586d962bf7511045ce9fd967ac60138c80a83 100644 (file)
@@ -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;
                }
 
index 32c2e9b86f93cd2938a8005f02ae5f26a0ebcc0d..f12f4465633855475ee40b67cac105ff1c5dd839 100644 (file)
@@ -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 {
index 7feab78ffde2de0ef80d7f337598f42cd1a88008..a72f0c91c86cc4a171c3158e197df22f6022403a 100644 (file)
@@ -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 {