]> granicus.if.org Git - php/commitdiff
replace zend_hash_find with zend_hash_str_find which fixes leaking the key
authorAnatol Belski <ab@php.net>
Wed, 10 Sep 2014 11:22:23 +0000 (13:22 +0200)
committerAnatol Belski <ab@php.net>
Wed, 10 Sep 2014 11:22:23 +0000 (13:22 +0200)
ext/oci8/oci8_interface.c
ext/oci8/oci8_statement.c

index a6b08bfdf9a1827df7344129daa311fc7cb522e8..a76b740a3b174daa045833a451bc5bcb82b7e3b7 100644 (file)
@@ -171,7 +171,7 @@ PHP_FUNCTION(oci_free_descriptor)
                }
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -205,7 +205,7 @@ PHP_FUNCTION(oci_lob_save)
                }
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -260,7 +260,7 @@ PHP_FUNCTION(oci_lob_import)
        }
 #endif
 
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -289,7 +289,7 @@ PHP_FUNCTION(oci_lob_load)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -329,7 +329,7 @@ PHP_FUNCTION(oci_lob_read)
                }       
        }
 
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -367,7 +367,7 @@ PHP_FUNCTION(oci_lob_eof)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -396,7 +396,7 @@ PHP_FUNCTION(oci_lob_tell)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -420,7 +420,7 @@ PHP_FUNCTION(oci_lob_rewind)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -453,7 +453,7 @@ PHP_FUNCTION(oci_lob_seek)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -499,7 +499,7 @@ PHP_FUNCTION(oci_lob_size)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -543,7 +543,7 @@ PHP_FUNCTION(oci_lob_write)
                }
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -579,12 +579,12 @@ PHP_FUNCTION(oci_lob_append)
                }       
        }
        
-       if ((tmp_dest = zend_hash_find(Z_OBJPROP_P(z_descriptor_dest), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
                RETURN_FALSE;
        }
        
-       if ((tmp_from = zend_hash_find(Z_OBJPROP_P(z_descriptor_from), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object");
                RETURN_FALSE;
        }
@@ -620,7 +620,7 @@ PHP_FUNCTION(oci_lob_truncate)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -680,7 +680,7 @@ PHP_FUNCTION(oci_lob_erase)
                }
        }
 
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -713,7 +713,7 @@ PHP_FUNCTION(oci_lob_flush)
                }
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -751,7 +751,7 @@ PHP_FUNCTION(ocisetbufferinglob)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -778,7 +778,7 @@ PHP_FUNCTION(ocigetbufferinglob)
                }       
        }
 
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -804,12 +804,12 @@ PHP_FUNCTION(oci_lob_copy)
                return;
        }
        
-       if ((tmp_dest = zend_hash_find(Z_OBJPROP_P(z_descriptor_dest), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_dest), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
                RETURN_FALSE;
        }
        
-       if ((tmp_from = zend_hash_find(Z_OBJPROP_P(z_descriptor_from), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_from), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object");
                RETURN_FALSE;
        }
@@ -846,12 +846,12 @@ PHP_FUNCTION(oci_lob_is_equal)
                return;
        }
        
-       if ((tmp_first = zend_hash_find(Z_OBJPROP_P(z_descriptor_first), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp_first = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_first), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The first argument should be valid descriptor object");
                RETURN_FALSE;
        }
        
-       if ((tmp_second = zend_hash_find(Z_OBJPROP_P(z_descriptor_second), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp_second = zend_hash_str_find(Z_OBJPROP_P(z_descriptor_second), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property. The second argument should be valid descriptor object");
                RETURN_FALSE;
        }
@@ -928,7 +928,7 @@ PHP_FUNCTION(oci_lob_export)
        }
 #endif
 
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -1024,7 +1024,7 @@ PHP_FUNCTION(oci_lob_write_temporary)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -1051,7 +1051,7 @@ PHP_FUNCTION(oci_lob_close)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_descriptor), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_descriptor), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                RETURN_FALSE;
        }
@@ -2170,7 +2170,7 @@ PHP_FUNCTION(oci_free_collection)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_collection), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
                RETURN_FALSE;
        }
@@ -2202,7 +2202,7 @@ PHP_FUNCTION(oci_collection_append)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_collection), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
                RETURN_FALSE;
        }
@@ -2236,7 +2236,7 @@ PHP_FUNCTION(oci_collection_element_get)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_collection), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
                RETURN_FALSE;
        }
@@ -2269,12 +2269,12 @@ PHP_FUNCTION(oci_collection_assign)
                }       
        }
        
-       if ((tmp_dest = zend_hash_find(Z_OBJPROP_P(z_collection_dest), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp_dest = zend_hash_str_find(Z_OBJPROP_P(z_collection_dest), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property. The first argument should be valid collection object");
                RETURN_FALSE;
        }
 
-       if ((tmp_from = zend_hash_find(Z_OBJPROP_P(z_collection_from), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp_from = zend_hash_str_find(Z_OBJPROP_P(z_collection_from), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property. The second argument should be valid collection object");
                RETURN_FALSE;
        }
@@ -2310,7 +2310,7 @@ PHP_FUNCTION(oci_collection_element_assign)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_collection), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
                RETURN_FALSE;
        }
@@ -2338,7 +2338,7 @@ PHP_FUNCTION(oci_collection_size)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_collection), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
                RETURN_FALSE;
        }
@@ -2366,7 +2366,7 @@ PHP_FUNCTION(oci_collection_max)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_collection), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
                RETURN_FALSE;
        }
@@ -2399,7 +2399,7 @@ PHP_FUNCTION(oci_collection_trim)
                }       
        }
        
-       if ((tmp = zend_hash_find(Z_OBJPROP_P(z_collection), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+       if ((tmp = zend_hash_str_find(Z_OBJPROP_P(z_collection), "descriptor", sizeof("descriptor"))) == NULL) {
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
                RETURN_FALSE;
        }
index 647aced75b94a33e743ef952c332fa25d4837edd..3e4d6154f2d522203c8fcb5f1377cba86b0cbafd 100644 (file)
@@ -683,7 +683,7 @@ int php_oci_statement_execute(php_oci_statement *statement, ub4 mode TSRMLS_DC)
 
                        /* find a user-set define */
                        if (statement->defines) {
-                               if ((outcol->define = zend_hash_find_ptr(statement->defines, zend_string_init(outcol->name, outcol->name_len, 0))) != NULL) {
+                               if ((outcol->define = zend_hash_str_find_ptr(statement->defines, outcol->name, outcol->name_len)) != NULL) {
                                        if (outcol->define->type) {
                                                outcol->data_type = outcol->define->type;
                                        }
@@ -1098,7 +1098,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
                {
                        zval *tmp;
                        
-                       if (Z_TYPE_P(var) != IS_OBJECT || (tmp = zend_hash_find(Z_OBJPROP_P(var), zend_string_init("collection", sizeof("collection"), 0))) == NULL) {
+                       if (Z_TYPE_P(var) != IS_OBJECT || (tmp = zend_hash_str_find(Z_OBJPROP_P(var), "collection", sizeof("collection"))) == NULL) {
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find collection property");
                                return 1;
                        }
@@ -1120,7 +1120,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
                {
                        zval *tmp;
                        
-                       if (Z_TYPE_P(var) != IS_OBJECT || (tmp = zend_hash_find(Z_OBJPROP_P(var), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+                       if (Z_TYPE_P(var) != IS_OBJECT || (tmp = zend_hash_str_find(Z_OBJPROP_P(var), "descriptor", sizeof("descriptor"))) == NULL) {
                                php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find descriptor property");
                                return 1;
                        }
@@ -1213,7 +1213,7 @@ int php_oci_bind_by_name(php_oci_statement *statement, char *name, int name_len,
        }
 
        memset((void*)&bind,0,sizeof(php_oci_bind));
-       if ((old_bind = zend_hash_find_ptr(statement->binds, zend_string_init(name, name_len + 1, 0))) != NULL) {
+       if ((old_bind = zend_hash_str_find_ptr(statement->binds, name, name_len)) != NULL) {
                bindp = old_bind;
                zval_ptr_dtor(&bindp->zval);
        } else {
@@ -1395,7 +1395,7 @@ sb4 php_oci_bind_out_callback(
                 * out-bind as the contents would have been changed for in/out
                 * binds (Bug #46994).
                 */
-               if ((tmp = zend_hash_find(Z_OBJPROP_P(val), zend_string_init("descriptor", sizeof("descriptor"), 0))) == NULL) {
+               if ((tmp = zend_hash_str_find(Z_OBJPROP_P(val), "descriptor", sizeof("descriptor"))) == NULL) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find object outbind descriptor property");
                        return OCI_ERROR;
                }