]> granicus.if.org Git - php/commitdiff
s/emalloc/safe_emalloc/ where appropriate.
authorIlia Alshanetsky <iliaa@php.net>
Thu, 18 Mar 2004 02:16:35 +0000 (02:16 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 18 Mar 2004 02:16:35 +0000 (02:16 +0000)
ext/com_dotnet/com_typeinfo.c
ext/com_dotnet/com_wrapper.c
ext/soap/php_encoding.c
ext/soap/soap.c

index 98c0a2e843dd2b048265d1270014eb75b1648ae5..ed521d1233688d392e139347970b0ef9296f3ce8 100644 (file)
@@ -489,7 +489,7 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri
                                        unsigned int funcdesclen, cnames = 0;
                                        BSTR *names;
 
-                                       names = (BSTR*)emalloc((func->cParams + 1) * sizeof(BSTR));
+                                       names = (BSTR*)safe_emalloc((func->cParams + 1), sizeof(BSTR), 0);
 
                                        ITypeInfo_GetNames(typeinfo, func->memid, names, func->cParams + 1, &cnames);
                                        /* first element is the function name */
index fc87f890ce2f6090698d1c62343c92596e5bac5a..0ca3247a452c44c91ebebf22806183a3160743ca 100644 (file)
@@ -272,7 +272,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex(
                
                /* convert args into zvals.
                 * Args are in reverse order */
-               params = (zval ***)emalloc(sizeof(zval **) * pdp->cArgs);
+               params = (zval ***)safe_emalloc(sizeof(zval **), pdp->cArgs, 0);
                for (i = 0; i < pdp->cArgs; i++) {
                        VARIANT *arg;
                        zval *zarg;
index 35ba391304c992deed28c9c77f05faec36b026cf..d3e2b31d1985b071601e5ce7ae56b0ff69ddf10a 100644 (file)
@@ -1362,7 +1362,7 @@ static int* get_position_12(int dimension, const char* str)
        int *pos;
        int i = -1, flag = 0;
 
-       pos = emalloc(sizeof(int)*dimension);
+       pos = safe_emalloc(sizeof(int), dimension, 0);
        memset(pos,0,sizeof(int)*dimension);
        while (*str != '\0' && (*str < '0' || *str > '9') && (*str != '*')) {
                str++;
@@ -1419,7 +1419,7 @@ static int* get_position(int dimension, const char* str)
 {
        int *pos;
 
-       pos = emalloc(sizeof(int)*dimension);
+       pos = safe_emalloc(sizeof(int), dimension, 0);
        get_position_ex(dimension, str, &pos);
        return pos;
 }
@@ -1557,7 +1557,7 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod
                                smart_str_appends(&array_type, value);
                        }
 
-                       dims = emalloc(sizeof(int)*dimension);
+                       dims = safe_emalloc(sizeof(int), dimension, 0);
                        dims[0] = i;
                        el = &data;
                        for (i = 1; i < dimension; i++) {
@@ -1647,14 +1647,14 @@ static xmlNodePtr to_xml_array(encodeTypePtr type, zval *data, int style, xmlNod
 
                        smart_str_append_long(&array_size, i);
 
-                       dims = emalloc(sizeof(int)*dimension);
+                       dims = safe_emalloc(sizeof(int), dimension, 0);
                        dims[0] = i;
                } else {
 
                        get_array_type(xmlParam, data, &array_type TSRMLS_CC);
                        enc = get_encoder_ex(SOAP_GLOBAL(sdl), array_type.c, array_type.len);
                        smart_str_append_long(&array_size, i);
-                       dims = emalloc(sizeof(int)*dimension);
+                       dims = safe_emalloc(sizeof(int), dimension, 0);
                        dims[0] = i;
                }
 
@@ -1832,7 +1832,7 @@ static zval *to_zval_array(encodeTypePtr type, xmlNodePtr data)
                dims = emalloc(sizeof(int));
                *dims = 0;
        }
-       pos = emalloc(sizeof(int)*dimension);
+       pos = safe_emalloc(sizeof(int), dimension, 0);
        memset(pos,0,sizeof(int)*dimension);
        if (data &&
            (attr = get_attribute(data->properties,"offset")) &&
index dd312b22d302464484ef4c67e92f6c6157df26b4..5e39ade5ee7005045715f2bbc119765254ae9c65 100644 (file)
@@ -1002,7 +1002,7 @@ PHP_METHOD(soapserver,setclass)
        FETCH_THIS_SERVICE(service);
 
        argc = ZEND_NUM_ARGS();
-       argv = emalloc(argc * sizeof(zval **));
+       argv = safe_emalloc(argc, sizeof(zval **), 0);
 
        if (argc < 1 || zend_get_parameters_array_ex(argc, argv) == FAILURE) {
                efree(argv);
@@ -1025,7 +1025,7 @@ PHP_METHOD(soapserver,setclass)
                        service->soap_class.argc = argc - 1;
                        if (service->soap_class.argc > 0) {
                                int i;
-                               service->soap_class.argv = emalloc(sizeof(zval) * service->soap_class.argc);
+                               service->soap_class.argv = safe_emalloc(sizeof(zval), service->soap_class.argc, 0);
                                for (i = 0;i < service->soap_class.argc;i++) {
                                        service->soap_class.argv[i] = *(argv[i + 1]);
                                        zval_add_ref(&service->soap_class.argv[i]);
@@ -2069,7 +2069,7 @@ PHP_METHOD(soapclient, __call)
 
        arg_count = zend_hash_num_elements(Z_ARRVAL_P(args));
 
-       real_args = emalloc(sizeof(zval *) * arg_count);
+       real_args = safe_emalloc(sizeof(zval *), arg_count, 0);
        for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(args), &pos);
                zend_hash_get_current_data_ex(Z_ARRVAL_P(args), (void **) &param, &pos) == SUCCESS;
                zend_hash_move_forward_ex(Z_ARRVAL_P(args), &pos)) {
@@ -2170,7 +2170,7 @@ static void soap_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_proper
                builtin_function->internal_function.handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
        } else {
                int arg_count = ZEND_NUM_ARGS();
-               zval **arguments = (zval **) emalloc(sizeof(zval *) * arg_count);
+               zval **arguments = (zval **) safe_emalloc(sizeof(zval *), arg_count, 0);
 
                zend_get_parameters_array(ht, arg_count, arguments);
                do_soap_call(this_ptr, function, Z_STRLEN(function_name->element) + 1, arg_count, arguments, return_value, NULL, NULL, NULL, NULL TSRMLS_CC);
@@ -2275,7 +2275,7 @@ static void deserialize_parameters(xmlNodePtr params, sdlFunctionPtr function, i
                        zend_hash_move_forward(function->requestParameters);
                }
                if (use_names) {
-                       tmp_parameters = emalloc(num_of_params * sizeof(zval *));
+                       tmp_parameters = safe_emalloc(num_of_params, sizeof(zval *), 0);
                        zend_hash_internal_pointer_reset(function->requestParameters);
                        while (zend_hash_get_current_data(function->requestParameters, (void **)&param) == SUCCESS) {
                                val = get_node(params, (*param)->paramName);
@@ -2307,7 +2307,7 @@ static void deserialize_parameters(xmlNodePtr params, sdlFunctionPtr function, i
                        trav = trav->next;
                }
                if (num_of_params > 0) {
-                       tmp_parameters = emalloc(num_of_params * sizeof(zval *));
+                       tmp_parameters = safe_emalloc(num_of_params, sizeof(zval *), 0);
 
                        trav = params;
                        while (trav != 0 && cur_param < num_of_params) {