[omniORB] Purify claims "freeing mismatch memory" on HPUX 10.20
Sai-Lai Lo
S.Lo@orl.co.uk
20 Oct 1998 18:52:45 +0100
>>>>> Zurek, Jan writes:
> 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?
Looks correct. It has been checked in.
Sai-Lai
--
Dr. Sai-Lai Lo | Research Scientist
|
E-mail: S.Lo@orl.co.uk | Olivetti & Oracle Research Lab
| 24a Trumpington Street
Tel: +44 223 343000 | Cambridge CB2 1QA
Fax: +44 223 313542 | ENGLAND