You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Henrik Nordberg (JIRA)" <ax...@ws.apache.org> on 2005/06/23 20:12:09 UTC
[jira] Commented: (AXISCPP-707) Incorrect use of delete in AxisEngineException::processException()
[ http://issues.apache.org/jira/browse/AXISCPP-707?page=comments#action_12314340 ]
Henrik Nordberg commented on AXISCPP-707:
-----------------------------------------
This bug has two parts. The first part was fixed by using the correct delete operator (i.e., delete[] ). The second part is STILL A SERIOUS BUG:
In the function XMLParserFactory::loadLib() in the file XMLParserFactory.cpp, this snippet of code has a bug:
throw AxisEngineException(SERVER_ENGINE_LOADING_PARSER_FAILED, PLATFORM_LOADLIB_ERROR);
PLATFORM_LOADLIB_ERROR is defined as a constant character pointer (which in this case is ""). But the semantics of the AxisEngineException requires that you pass in a char* and transfer ownership to AxisEngineException.
So you MUST NOT pass in PLATFORM_LOADLIB_ERROR as the second argument above. You MUST make a copy using operator new.
The problem is really the design of AxisEngineException. It should use std::string and not char*. It is too error prone (and is probably just one of the bugs that have or will result from it).
> Incorrect use of delete in AxisEngineException::processException()
> ------------------------------------------------------------------
>
> Key: AXISCPP-707
> URL: http://issues.apache.org/jira/browse/AXISCPP-707
> Project: Axis-C++
> Type: Bug
> Components: Server - Engine
> Versions: current (nightly)
> Environment: Windows XP Pro, VS2003
> Reporter: Henrik Nordberg
> Assignee: Dushshantha Chandradasa
> Priority: Critical
>
> There is a delete statement in AxisEngineException::processException() which
> has a couple of problems:
> First, if you were supposed to delete the pointer passed in, delete[] should
> be used (in C++). But, at least in the case of the exception thrown when a
> library fails to load, a constant character pointer is passed in (in this
> case "") -- see this line in XMLParserFactory::loadLib():
> throw AxisEngineException(SERVER_ENGINE_LOADING_PARSER_FAILED,
> PLATFORM_LOADLIB_ERROR);
> Why not just use a const std::string& instead of char*?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira