title: Xcode memory leak when using SQLite3 API
body: <p>i am using the following code snippet to add new element/row with name to Sqlite3 database, Every thing works fine, But this is giving memory leaks each time, when i call this function, Can any one help me how to avoid this problem?</p>
  
  <pre><code>{
  
      sqlite3 *database;
  
  sqlite3_stmt *addStmt;
      NSString *localdescription=@"Enter your Notes here";
  
  if(sqlite3_open([databasePath UTF8String], &amp;database) == SQLITE_OK) 
  {
      const char *sql = "insert into database(name) Values(?)";
      if(sqlite3_prepare_v2(database, sql, -1, &amp;addStmt, NULL) == SQLITE_OK)
      {
  
      sqlite3_bind_text(addStmt, 1, [localName UTF8String], -1, SQLITE_TRANSIENT);
  
  
      if(SQLITE_DONE != sqlite3_step(addStmt))
          NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database));
      else
          //SQLite provides a method to get the last primary key inserted by using sqlite3_last_insert_rowid
          NSLog(@"id=====%d",sqlite3_last_insert_rowid(database));
  
      //Reset the add statement.
      sqlite3_reset(addStmt);
  
  
      }
  
          }
      sqlite3_close(database);
  }
  </code></pre>