Incorrect memory is allocated for attributes
--------------------------------------------

                 Key: AXIS2C-770
                 URL: https://issues.apache.org/jira/browse/AXIS2C-770
             Project: Axis2-C
          Issue Type: Bug
          Components: code generation
    Affects Versions: Current (Nightly)
            Reporter: Michael Mole


I noticed in CADBBeanTemplateSource.xsl that some of the attributes have 
incorrect use of parenthesis which leads to incorrect memory allocation.
For example (Note this code was taken somewhere in the range of line 2509):
If you look at lines 4 and 5, we are trying to add 3 numbers: 64, and the 
values returned from each strlen.  The 1st strlen does not close off it's 
parenthesis before trying to add the value returned by the 2nd strlen.

1                        <xsl:when 
test="$nativePropertyType='axutil_base64_binary_t*'">
2                          text_value =  
axutil_base64_binary_get_encoded_binary(<xsl:value-of 
select="$propertyInstanceName"/>, env);
3                           string_to_stream = (axis2_char_t*) AXIS2_MALLOC 
(env-> allocator, sizeof (axis2_char_t) *
4                                                            (64 + 
strlen("<xsl:value-of select="$propertyName"/>" +
5                                                             
strlen(text_value))));
6                           sprintf(string_to_stream, " <xsl:value-of 
select="$namespacePrefix"/><xsl:value-of select="$propertyName"/>=\"%s\"", 
text_value);
7                           axutil_stream_write(stream, env, string_to_stream, 
axutil_strlen(string_to_stream));
8                           AXIS2_FREE(env-> allocator, string_to_stream);

Lines 4 and 5 should look something more like this:
I've added a ) right before the + on line 4 and removed a ) right before the ; 
on line 5.
4                                                            (64 + 
strlen("<xsl:value-of select="$propertyName"/>") +
5                                                             
strlen(text_value)));

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to