我知道为什么每次调用它时这个函数都会泄漏内存?
char *getData(sqlite3 *db)
{
char *ret;
sqlite3_stmt *res;
int rc = sqlite3_prepare_v2(db, SELECT_STATEMENT_SQL, -1, &res, 0);
if (rc != SQLITE_OK) {
sprintf(stderr, "%s\n", sqlite3_errmsg(db));
return stderr;
}
rc = sqlite3_step(res);
if (rc == SQLITE_ROW) {
ret = sqlite3_column_text(res, 0);
} else {
ret = "error!";
}
sqlite3_free(res);
return ret;
}