tags:

views:

41

answers:

1

alt text alt text alt text Hi, im finding leaks with the leaks instruments tool but have no idea why this method is returning me leaks. any help? code is below

if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {
    // Setup the SQL Statement and compile it for faster access
    NSString *str = [NSString stringWithFormat:@"SELECT UsageData.Date,UsageData.Time,UsageData.NoOfMovementRegistered,UsageData.BreathingRate,UsageData.TimeSinceLastMovement,UsageData.Status,UsageData.bID FROM UsageData INNER JOIN Beds ON UsageData.bID = Beds.bID  WHERE Status = 'Alert' OR Status = 'Unused' GROUP BY UsageData.bID ORDER BY UsageData.bID LIMIT '%d'",[appDelegate.beds count]];
    const char *sqlStatement = [str UTF8String];
    sqlite3_stmt *compiledStatement;

    if(sqlite3_prepare_v2(database, sqlStatement,-1, &compiledStatement, NULL) == SQLITE_OK) {
        // Loop through the results and add them to the feeds array
        while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
            // Read the data from the result row
        //leak  NSString *aDate = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 0)] ;
        //leak  NSString *aTime = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)] ;
        //leak  NSString *aNoOfMoveReg = [NSString  stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)] ;
        //leak  NSString *aBreathRate = [NSString  stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 3)] ;
        //leak  NSString *aTimeSinceLastMovement = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 4)] ;
        //leak  NSString *aStatus = [NSString  stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 5)] ;
        //leak  NSString *aBID = [NSString  stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 6)] ;

            NSLog(@"aDate %@",aDate);
            NSLog(@"aTime %@",aTime);
            NSLog(@"aNoOfMoveReg %@",aNoOfMoveReg);
            NSLog(@"aBreathRate %@",aBreathRate);
            NSLog(@"aTimeSinceLastMovement %@",aTimeSinceLastMovement);
            NSLog(@"aStatus %@",aStatus);
            NSLog(@"aBID %@",aBID);


            IconUsageData *usagedata = [[IconUsageData alloc] initWithDate:aDate time:aTime noofmovereg:aNoOfMoveReg breathrate:aBreathRate timesincelastmovement:aTimeSinceLastMovement status:aStatus bedid:aBID];
            [appDelegate.iconUsageDatas addObject:usagedata];

            [usagedata release];

            [aDate release];
        }
    }
    // Release the compiled statement from memory
    sqlite3_finalize(compiledStatement);
}
sqlite3_close(database);

*edited to show screenshot above

A: 

solved, in a variable not under the scope of the above codes, there is one that is not being released.

Kenneth