axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Samisa Abeysinghe <sam...@wso2.com>
Subject Re: memory leak in generated code
Date Tue, 06 Jul 2010 23:23:46 GMT
This needs to be fixed in the code generation template so that the fix works
right for all generated code.

Is it possible for you to provide a patch for that?

Samisa...

On Sun, Jun 27, 2010 at 10:32 PM, Steve Leland <steve@pouchapond.com> wrote:

> Hi,
>
> I am running on Windows Server 2008 R2, and using a build I made yesterday
> (svn 957643) I generated code from our wsdl and ran it - it has a leak that
> was also present in the 1.6.0 release.
>
> Given this in the wsdl file:
>
>     <s:complexType name="CalendarEvent">
>       <s:sequence>
>         <s:element minOccurs="1" maxOccurs="1" name="StartTime"
> type="s:dateTime" />
>         <s:element minOccurs="1" maxOccurs="1" name="EndTime"
> type="s:dateTime" />
>         <s:element minOccurs="1" maxOccurs="1" name="BusyType"
> type="tns:LegacyFreeBusyType" />
>         <s:element minOccurs="0" maxOccurs="1" name="CalendarEventDetails"
> type="tns:CalendarEventDetails" />
>       </s:sequence>
>     </s:complexType>
>
> the following code is generated:
>
>                  if (!_CalendarEvent->is_valid_StartTime)
>                  {
>
>
>                           AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Nil
> value found in non-nillable property StartTime");
>                           return NULL;
>
>                  }
>                  else
>                  {
>                    start_input_str =
> (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>                                (4 + axutil_strlen(p_prefix) +
>                                 axutil_strlen("StartTime")));
>
>                                /* axutil_strlen("<:>") + 1 = 4 */
>                    end_input_str =
> (axis2_char_t*)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) *
>                                (5 + axutil_strlen(p_prefix) +
> axutil_strlen("StartTime")));
>                                 /* axutil_strlen("</:>") + 1 = 5 */
>
>
>
>
>
>
>                    /*
>                     * parsing StartTime element
>                     */
>
>
>
>                           sprintf(start_input_str, "<%s%sStartTime>",
>                                p_prefix?p_prefix:"",
>                                (p_prefix && axutil_strcmp(p_prefix,
> ""))?":":"");
>
>                       start_input_str_len = axutil_strlen(start_input_str);
>                       sprintf(end_input_str, "</%s%sStartTime>",
>                                p_prefix?p_prefix:"",
>                                (p_prefix && axutil_strcmp(p_prefix,
> ""))?":":"");
>                       end_input_str_len = axutil_strlen(end_input_str);
>
>                         text_value_1 =
> axutil_date_time_serialize_date_time(_CalendarEvent->property_StartTime,
> env);
>
>                          axutil_stream_write(stream, env, start_input_str,
> start_input_str_len);
>
>                          axutil_stream_write(stream, env, text_value_1,
> axutil_strlen(text_value_1));
>
>                          axutil_stream_write(stream, env, end_input_str,
> end_input_str_len);
>
>                -> fix goes here <-
>                    AXIS2_FREE(env->allocator,start_input_str);
>                    AXIS2_FREE(env->allocator,end_input_str);
>                }
>
> The leak is "text_value_1" not being freed.  To fix the leak, add
> AXIS2_FREE(env->allocator,text_value_1);
> where indicated.
>
> Regards,
> Steve
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@axis.apache.org
> For additional commands, e-mail: c-dev-help@axis.apache.org
>
> Samisa Abeysinghe
VP Engineering
WSO2 Inc.
http://wso2.com
http://wso2.org

Mime
View raw message