Re: Debugging memory corruption? (C++)
Re: Debugging memory corruption? (C++)
- Subject: Re: Debugging memory corruption? (C++)
- From: Jens Alfke <email@hidden>
- Date: Mon, 2 Nov 2009 15:00:25 -0800
On Nov 2, 2009, at 2:25 PM, Jean-Denis Muys wrote: Well, I thought I had solved my memory corruption bug. Not so fast! It still seems to happen. I have managed to trace the crash in mySQL C++/Connector to the call of a destructor at exit of the routine listed below. And according to *my* understanding of C++ that destructor should not have been called from that routine, because, the destructor is not called on an automatic variable, but on a data member of this.
Actually the destructor should be called. The method you posted is a constructor, and when an exception is thrown out of a constructor, the matching destructor is invoked so the object gets cleaned up. The member result_bind is an auto_ptr member of your class, so it gets destructed as part of your class's destructor.
From the code, it looks as though r_bind may be a bogus pointer on entry and that's why the free() call in the auto_ptr's destructor crashes?
—Jens |
_______________________________________________
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