You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2008/03/15 07:13:35 UTC

svn commit: r637363 - /webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateSource.xsl

Author: dimuthu
Date: Fri Mar 14 23:13:30 2008
New Revision: 637363

URL: http://svn.apache.org/viewvc?rev=637363&view=rev
Log:
Correcting memeory leaks issue

Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateSource.xsl

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateSource.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateSource.xsl?rev=637363&r1=637362&r2=637363&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateSource.xsl (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/CADBBeanTemplateSource.xsl Fri Mar 14 23:13:30 2008
@@ -3705,6 +3705,7 @@
                                         (p_prefix && axutil_strcmp(p_prefix, ""))?":":"");
                                         
                             axutil_stream_write(stream, env, start_input_str, axutil_strlen(start_input_str));
+                            AXIS2_FREE(env->allocator,start_input_str);
                           </xsl:otherwise>
                         </xsl:choose>
                       </xsl:if>
@@ -3806,7 +3807,6 @@
                             if(!adb_<xsl:value-of select="@type"/>_is_particle())
                             {
                                 axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                                AXIS2_FREE(env->allocator,start_input_str);
                             }
                             </xsl:if>
                             
@@ -3825,7 +3825,6 @@
                             if(!adb_<xsl:value-of select="@type"/>_is_particle())
                             {
                                 axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                                AXIS2_FREE(env->allocator,end_input_str);
                             }
                             </xsl:if>
                         </xsl:when>
@@ -3842,12 +3841,10 @@
                            </xsl:choose>
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -3881,12 +3878,10 @@
                            </xsl:choose>
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -3901,12 +3896,10 @@
                            </xsl:choose>
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -3921,12 +3914,10 @@
                            </xsl:choose>
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -3942,12 +3933,10 @@
                            </xsl:choose>
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -3962,12 +3951,10 @@
                            </xsl:choose>
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -3985,12 +3972,10 @@
                            </xsl:choose>
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -4006,12 +3991,10 @@
                            </xsl:choose>
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -4027,12 +4010,10 @@
                            </xsl:choose>
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -4048,12 +4029,10 @@
                            </xsl:choose>
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -4062,7 +4041,6 @@
                            text_value_<xsl:value-of select="$position"/> = <xsl:value-of select="$propertyInstanceName"/>;
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                             
                            text_value_<xsl:value-of select="$position"/>_temp = axutil_xml_quote_string(env, text_value_<xsl:value-of select="$position"/>, AXIS2_TRUE);
@@ -4077,7 +4055,6 @@
                            }
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -4086,12 +4063,10 @@
                            text_value_<xsl:value-of select="$position"/> = axutil_uri_to_string(<xsl:value-of select="$propertyInstanceName"/>, env, AXIS2_URI_UNP_OMITUSERINFO);
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -4100,12 +4075,10 @@
                            text_value_<xsl:value-of select="$position"/> = axutil_duration_serialize_duration(<xsl:value-of select="$propertyInstanceName"/>, env);
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -4114,7 +4087,6 @@
                            <!-- Handled above -->
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
 
                            <!-- TODO: Do this in single step -->
@@ -4149,7 +4121,6 @@
                            AXIS2_FREE(env-> allocator, text_value_<xsl:value-of select="$position"/>);
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -4158,12 +4129,10 @@
                            strcpy(text_value_<xsl:value-of select="$position"/>, (<xsl:value-of select="$propertyInstanceName"/>)?"true":"false");
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -4174,12 +4143,10 @@
                                 text_value_<xsl:value-of select="$position"/> = axiom_node_to_string(<xsl:value-of select="$propertyInstanceName"/>, env);
                                 <xsl:if test="not(@any)">
                                 axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                                AXIS2_FREE(env->allocator,start_input_str);
                                 </xsl:if>
                                 axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                                 <xsl:if test="not(@any)">
                                 axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                                AXIS2_FREE(env->allocator,end_input_str);
                                 </xsl:if>
                               </xsl:when>
                               <xsl:otherwise>
@@ -4193,12 +4160,10 @@
                           text_value_<xsl:value-of select="$position"/> = axutil_date_time_serialize_date_time(<xsl:value-of select="$propertyInstanceName"/>, env);
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -4206,12 +4171,10 @@
                           text_value_<xsl:value-of select="$position"/> =axutil_base64_binary_get_encoded_binary(<xsl:value-of select="$propertyInstanceName"/>, env);
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, start_input_str, start_input_str_len);
-                           AXIS2_FREE(env->allocator,start_input_str);
                            </xsl:if>
                            axutil_stream_write(stream, env, text_value_<xsl:value-of select="$position"/>, axutil_strlen(text_value_<xsl:value-of select="$position"/>));
                            <xsl:if test="$anon or $istype">
                            axutil_stream_write(stream, env, end_input_str, end_input_str_len);
-                           AXIS2_FREE(env->allocator,end_input_str);
                            </xsl:if>
                         </xsl:when>
 
@@ -4225,6 +4188,9 @@
                    <xsl:if test="@isarray">
                          }
                      }
+                     <!-- This two should be freed after the loop for array-->
+                     AXIS2_FREE(env->allocator,start_input_str);
+                     AXIS2_FREE(env->allocator,end_input_str);
                    </xsl:if>
                  } <!-- else for non nillable -->
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org