views:

108

answers:

2
//opening DB
if(sqlite3_step(statement) == SQLITE_ROW)
    result = [NSString stringWithUTF8String:(char*)sqlite3_column_text(statement,0)];  //!
else
    result nil;
return result;
//close DB
A: 

the string should be autoreleased by stringWithUTF8String, are you testing for memory leaks on the iPhone or on the simulator? Often the simulator code is just a touch buggier - try it on the device itself

Rob Fonseca-Ensor
yes i'm testing on a simulator, cause the device debugging is really slow:( 10x for answers, probably it's a buggy simulator
max
+2  A: 

This is actually not a memory leak. The NSString will be autoreleased, and the char* returned by sqlite3_column_text will be cleaned up by sqlite during the next step/reset/finalize call.

Terry Mahaffey
Yeah, sometimes the analysis fails to recognise constructors like this and think they are leaks when they aren't.
AlBlue
You need to post the actual output of the analyzer. It should recognize that just fine.
bbum