Uploaded image for project: 'Axis2-C'
  1. Axis2-C
  2. AXIS2C-1529

wsdl2c generates skeleton code with memoryleak inside

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.6.0
    • 1.7.0
    • wsdl2c tool
    • None

    Description

      One can reproduce the problem with the following steps:
      1. Compile the following java class (only to generate a appropriate wsdl used in step 2)
      package memleak;

      public class MemLeak
      {
      public byte[] getServiceData(byte[] input)

      { byte[] output = new byte[10]; return(output); }

      }

      2. generate wsdl with the following command from the MemLeak class
      java2wsdl -o . -of axis2cwsdl2cmembug.wsdl -sn axis2cmemleak -cn memleak.MemLeak

      3. generate serverside code (skeletons) from the axis2cwsdl2cmembug.wsdl with the following command:
      wsdl2c -o .\c_axis2cwsdl2membug_skeleton -ss -uri axis2cwsdl2cmembug.wsdl

      Step 3. generates the following artefacts:
      ./axis2_skel_axis2cmemleak.c
      ./axis2_skel_axis2cmemleak.h
      ./axis2_svc_skel_axis2cmemleak.c
      ./src
      ./src./adb_getServiceData.c
      ./src./adb_getServiceData.h
      ./src./adb_getServiceDataResponse.c
      ./src./adb_getServiceDataResponse.h

      Especially .the generated code /src./adb_getServiceDataResponse.c contains a memory leak in the function
      adb_getServiceDataResponse_serialize
      within every webservice request cycle.
      Following code is generated in this function:

      text_value_1 =axutil_base64_binary_get_encoded_binary(_getServiceDataResponse->property_return, 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);

      AXIS2_FREE(env->allocator,start_input_str);
      AXIS2_FREE(env->allocator,end_input_str);

      memory for start_input_str and for end_input_str are released , BUT not the memory allocated in axutil_base64_binary_get_encoded_binary for the pointer text_value_1.
      An AXIS2_FREE(env->allocator,text_value_1.); is missed.
      This AXIS2_FREE can be included in the generated code, solving the memory leak without destabilizing the service.

      Attachments

        1. adb_getServiceDataResponse.c
          22 kB
          Christof Schmalenbach
        2. axis2cwsdl2cmembug.wsdl
          4 kB
          Christof Schmalenbach
        3. MemLeak.java
          0.1 kB
          Christof Schmalenbach

        Activity

          People

            Unassigned Unassigned
            cschmale@asf Christof Schmalenbach
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified