You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Alberto Massari (JIRA)" <xe...@xml.apache.org> on 2015/09/05 15:21:45 UTC

[jira] [Resolved] (XERCESC-2050) wrong use of delete keyword in DTest.cpp

     [ https://issues.apache.org/jira/browse/XERCESC-2050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alberto Massari resolved XERCESC-2050.
--------------------------------------
       Resolution: Fixed
    Fix Version/s: 3.1.3

> wrong use of delete keyword in DTest.cpp
> ----------------------------------------
>
>                 Key: XERCESC-2050
>                 URL: https://issues.apache.org/jira/browse/XERCESC-2050
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Samples/Tests
>    Affects Versions: 3.1.2
>            Reporter: Hanno Böck
>            Assignee: Alberto Massari
>            Priority: Minor
>             Fix For: 3.1.3
>
>         Attachments: xerces-c-fix-alloc-dealloc.diff
>
>
> In the file DTest.cpp there is a wrong use of the delete keyword. The variable hugeString is allocated with:
>     char* hugeString=new char[HUGE_STRING+1];
> It gets deallocated with:
>     delete hugeString;
> When allocating a variable with "new type[size]" one has to deallocate with "delete [] variable". These kinds of errors can be seen when compiling with address sanitizer. I'll attach a patch.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org