[omniORB] Freeing mismatched memory.
Dietmar May
dcmay@object-workshops.com
Wed, 3 Feb 1999 16:28:43 -0500
Henrik,
Assuming that this code is running inside an orb, and firstname is an out
parameter, you need to use CORBA::string_alloc() or CORBA::string_dup(); NOT
C++ new. You're almost guaranteed to have some bad side effects (at least on
some ORBs) if you don't.
> CORBA::UShort A::member(const char *name,char* &firstname)
> {
> char *xyz;
> ....
>
> if(!(firstname = new char[strlen(xyz)+1]))
> Warning ....
> strcpy(firstname,xyz);
>
> return 0;
> }
Regards,
Dietmar May
Software Architect
Object Workshops, Inc.
http://www.object-workshops.com