[omniORB] Purify claims "freeing mismatch memory" on HPUX 10.20

Zurek, Jan Jan.Zurek@dresdner-bank.de
Fri, 16 Oct 1998 15:03:48 +0200


Hi!

We have just build a "purified" version of omniORB 2.6.0 with HP aCC A.01.15
compiler and encountered a memory problem. There is a "freeing mismatched
memory" error in the constructor of tcpSocketIncomingRope. This error means
that memory has been allocated with new[] and freed with delete or vice
versa.

The error is located in the nested class hostent_var of class LibcWrapper
where the member pd_buffer is allocated in the method gethostbyname() with
the following command:
	h.pd_buffer = (char*)(new hostent_data);
but freed in destructor of LibcWrapper with
	delete [] pd_buffer;

According to statements of the HP-Labs this may result in unspecified
behaviour. We have changed the allocation to
	h.pd_buffer = new char[sizeof(hostent_data)];
in file libcWrapper.cc, line 124 and everything works fine.

Does anyone have any comments or rejections on that?
Can this code be changed in future releases?

Regards
Jan Zurek
Dresdner Kleinwort Benson
Global Markets Division
Information Technology
Tel: 	+49 69 263 6318
Fax: 	+49 69 263 11454
e-mail:	jan.zurek@dresdner-bank.de
<http://www.ltt.de/ciow97/pr_oo_winners_e.html>