• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C++ std::string tries to free() a not allocated pointer ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ std::string tries to free() a not allocated pointer ?


  • Subject: Re: C++ std::string tries to free() a not allocated pointer ?
  • From: Jean-Denis Muys <email@hidden>
  • Date: Thu, 19 Nov 2009 16:34:32 +0100

On Thursday, November 19, 2009, at 04:15PM, "Robert Schwalbe" <email@hidden> wrote:
>
>I would also contend that your assignment operators should protect
>against self assignment, e.g:
>
>     const SQLString & operator=(const SQLString & rhs)
>     {
>         if (this != &rhs) {
>             realStr = rhs.realStr;
>         }
>         return *this;
>     }
>

Perhaps, though in that case, I think it would be harmless.
As I mentioned, I am not the author. This code is in mySQL connector-C++ library.

I just declare a local variable of type SQLString, that malloc complains about destructing when it leaves its lexical scope:

{
		sql::SQLString temp = res->getString(colNum);  // getString basically does "return sql::SQLString(p, 0);" where p points to a new char[23]
		// use temp some
}		// malloc complains destructing temp "pointer was not allocated"

JD
 _______________________________________________
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

  • Prev by Date: Re: C++ std::string tries to free() a not allocated pointer ?
  • Next by Date: Re: C++ std::string tries to free() a not allocated pointer ?
  • Previous by thread: Re: C++ std::string tries to free() a not allocated pointer ?
  • Next by thread: Re: C++ std::string tries to free() a not allocated pointer ?
  • Index(es):
    • Date
    • Thread