Hanno Böck created XERCESC-2050:
-----------------------------------

             Summary: 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
            Priority: Minor
         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-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org

Reply via email to