title: Memory Leak using sqlite
body: <p>I am getting a memory leak warning on Instruments for these lines:</p>
  
  <pre><code> NSString *name =[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 0)];
  
   year = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)];
  </code></pre>
  
  <p>Here is the code for this section:</p>
  
  <pre><code>-(NSMutableArray *)selectUsersList:(NSString *)condition:(NSString *)sort
  {
      NSMutableArray *users = [[NSMutableArray alloc] init];
  
      if (sqlite3_open([self.databasePath UTF8String], &amp;database) != SQLITE_OK)
      {
        sqlite3_close(database);
        NSAssert(0, @"Failed to open database");
      }
      else 
      {
        NSString *query = @"SELECT * FROM users";
        if (condition != nil)
        {
          NSString *newQuery = [NSString stringWithFormat:@"%@ %@", query, condition];
          query = newQuery;
        }
        if (sort != nil) {
          NSString *newsort = [NSString stringWithFormat:@"%@ %@", query, sort];
          query = newsort;
        }
        sqlite3_stmt *statement;
  
        if (sqlite3_prepare_v2(database, [query UTF8String], -1, &amp;statement, nil) == SQLITE_OK)
        {
          while (sqlite3_step(statement) == SQLITE_ROW) {
              NSString *name =[NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 0)];
              }
              NSString *year= @"";
              if (sqlite3_column_text(statement, 2) != nil)
              {
                  year = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 2)];
              }
  
              User *user = [[User alloc] initWithName:name year:year];
  
              [users addObject:user]; 
              [user release];             
          }
      }
      sqlite3_finalize(statement);
      sqlite3_close(database);
    }
    return users;
  }
  </code></pre>
  
  <p>I want to present an empty string and not 'nil' on the view so I am setting year to an empty string first. Is there a better way to do this? How can I solve this leak?</p>
  
  <p>Thanks for your help! </p>