> So, u cannot do:
>
>     {
>         ...
>         char* foo = strstr(nodeAux.getNodeValue().transcode(),
> SEARCHSTRING);
>         ...
>     }
> without dumping memory, don't u?
>

no you can not do this. from DOMString.cpp:

----------------------

        char* retP = new char[charsNeeded + 1];

[...]

        // Cap it off and return it
        retP[charsNeeded] = 0;
        return retP;
}

----------------------

so to free the (temporary) space you should do

        char *foo = nodeAux.getNodeValue().transcode();
        delete [] cp;

and the use of new char[] forbids us to use

        auto_ptr<char> foo(nodeAux.getNodeValue().transcode());

because auto_ptr<> does use

        delete _Tp;

instead of the needed

        delete [] _Tp;

and inheriting from STL's is (mostly) a bad idea (perhaps not in the auto_ptr<> case).

one could write its own array enabled auto_ptr<> perhaps :).

stefan


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

Reply via email to