]> granicus.if.org Git - php/commitdiff
Avoid usage of uninitialized data
authorDmitry Stogov <dmitry@zend.com>
Thu, 15 Jan 2015 18:08:21 +0000 (21:08 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 15 Jan 2015 18:08:21 +0000 (21:08 +0300)
Zend/zend_object_handlers.c

index 2dde1d18d7f26297a718a3c64a90dd72810121d4..c1e8a54539cd4cbe864b7e6dba72d3be91553605 100644 (file)
@@ -1035,15 +1035,14 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str
 
        if (EXPECTED(key != NULL)) {
                lc_method_name = Z_STR_P(key);
+               use_heap = 0;
        } else {
                STR_ALLOCA_ALLOC(lc_method_name, method_name->len, use_heap);
                zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len);
        }
 
        if (UNEXPECTED((func = zend_hash_find(&zobj->ce->function_table, lc_method_name)) == NULL)) {
-               if (UNEXPECTED(!key)) {
-                       STR_ALLOCA_FREE(lc_method_name, use_heap);
-               }
+               STR_ALLOCA_FREE(lc_method_name, use_heap);
                if (zobj->ce->__call) {
                        return zend_get_user_call_function(zobj->ce, method_name);
                } else {
@@ -1098,9 +1097,7 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str
                }
        }
 
-       if (UNEXPECTED(!key)) {
-               STR_ALLOCA_FREE(lc_method_name, use_heap);
-       }
+       STR_ALLOCA_FREE(lc_method_name, use_heap);
        return fbc;
 }
 /* }}} */