What about

       delete __[ ]__ str;


Regards,

Peiyong Zhang
____________________________________________
XML Parsers Development
IBM Toronto Laboratory email: [EMAIL PROTECTED]
Phone: (416)448-4088; Fax: (416)448-4414; T/L: 778-4088



[EMAIL PROTECTED] on 07/03/2001 04:29:39 PM

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:
Subject:  [Bug 2440] New: - delete on pointer from transcode() failed


http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2440

*** shadow/2440           Tue Jul  3 13:29:39 2001
--- shadow/2440.tmp.10932           Tue Jul  3 13:29:39 2001
***************
*** 0 ****
--- 1,37 ----
+
+============================================================================+

+ | delete on pointer from transcode() failed
|
+
+----------------------------------------------------------------------------+

+ |        Bug #: 2440                        Product: Xerces-C
|
+ |       Status: NEW                         Version: 1.4
|
+ |   Resolution:                            Platform: PC
|
+ |     Severity: Major                    OS/Version: Windows 9x
|
+ |     Priority: Other                     Component: DOM
|
+
+----------------------------------------------------------------------------+

+ |  Assigned To: [EMAIL PROTECTED]
|
+ |  Reported By: [EMAIL PROTECTED]
|
+ |      CC list: Cc:
|
+
+----------------------------------------------------------------------------+

+ |          URL:
|
+
+============================================================================+

+ |                              DESCRIPTION
|
+ I have DOM_Node object and I'm getting value of node:
+ DOMString value = DOM_Node::getNodeValue();
+
+ Then, I'm getting pointer to a newly allocated buffer of char elements:
+ char* str = value.transcode();
+
+ Then, I'm going to delete that allocated area:
+ delete str; // DAMAGE before free block
+
+ What do I do wrong? I was looking into your code in DOMPrint.cpp and
found this
+ piece:
+ ostream& operator<< (ostream& target, const DOMString& s)
+ {
+     char *p = s.transcode();
+     target << p;
+     delete [] p;
+     return target;
+ }
+ Looks like the same! But something I'm overlooking... Because of that my
+ program has memory leaks. Could you please explain me my mistake ASAP.
It's
+ critical for my project. Thank you.

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





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

Reply via email to