EXC_BAD_ACCESS after query.storein()
Posted by: Alan Shank
Date: February 03, 2011 03:52PM
My code, which works fine in Linux (Ubuntu 10.10) looks like this:
conn.connect(db, server, user, pass)
Query query = conn.query("Update blah blah");
query.execute(); // inside try,catch,catch block
query << "Another update";
query << "Yet another";
query << "select this, that and the other thing";
vector<deepskyStruct> resvec; // deepskyStruct is an ssqls structure
for loop through the vector, creating members of class SessionObject from the data
start another transaction
query << "Update a different table";
query.execute(); //two more of these
query << "Select blah, blah blah from a different table";
//Up to here, everything is fine, and I have verified that all the updates took place. I also know that the first select, storing in resvec, creating the objects, etc. worked, because when I commented out the stuff for the 2nd table the program completed successfully with the expected output.
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x0000041c
0x93d12a8d in std::string::clear ()
The address of resvec2 was 0xbfffefdc, while the address of resvec was 0xbfffefb0 or sth in that neighborhood.
Any help appreciated.