Re: C++ std::string tries to free() a not allocated pointer ?
Re: C++ std::string tries to free() a not allocated pointer ?
- Subject: Re: C++ std::string tries to free() a not allocated pointer ?
- From: Robert Schwalbe <email@hidden>
- Date: Wed, 18 Nov 2009 14:05:23 -0500
class SQLString
{
std::string realStr;
public:
~SQLString() {}
SQLString(const char * s, size_t n) : realStr(s, n) {}
};
[other public member functions irrelevant because not called.]
3- a buffer is allocated with 23 bytes in the library, form which a
SQLString is constructed.
The calling sequence I stepped through in the library is:
buffer = new char[23];
buffer[0] = 0;
length = 0;
return SQLString(buffer, length);
4- that return statement constructs a temporary SQLString through
that call chain:
Try providing a copy constructor for your SQLString class.
I believe without the presence of a copy constructor a blockmove/memcopy
is performed and that will not copy the realStr member as it should.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden