axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henrik Nordberg (JIRA)" <axis-c-...@ws.apache.org>
Subject [jira] Commented: (AXISCPP-707) Incorrect use of delete in AxisEngineException::processException()
Date Thu, 30 Jun 2005 16:30:01 GMT
    [ http://issues.apache.org/jira/browse/AXISCPP-707?page=comments#action_12314785 ] 

Henrik Nordberg commented on AXISCPP-707:
-----------------------------------------

The testing needs to include a scenario that causes this line
    throw AxisEngineException(SERVER_ENGINE_LOADING_PARSER_FAILED, PLATFORM_LOADLIB_ERROR);

in the function XMLParserFactory::loadLib() in the file XMLParserFactory.cpp to be executed
on the Win32 platform.

The fix should be to not delete the argument passed to Axis####Exception::processException().
The easiest way to do that is to change the argument type to "const std::string&". Note
that this does not force people using the class to use std::string. They can still pass const
char*. Also since this code seems to be the same for Axis exceptions, maybe it can be move
to a base class.

The fact that the server is working without any crash (I assume you mean GPF or core dump)
says little about the stability of the server. You need to run it with a memory checking tool.
I recommend using Valgrind 2.4.0 (www.valgrind.org, download, ./configure, make, su, make
install). I run it like this:
valgrind /usr/sbin/httpd -X -k start -f /home/henrik/httpd/httpd.conf

When you can run your tests without valgrind reporting any problems, then you can feel better
about the quality of the code.


> 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


Mime
View raw message