Skip to content

Commit 5c1fdc9

Browse files
authored
Fix session changeset procesing (reverting some of 0d748ad changes) (#949)
This removes strdup from Lua SQLite wrapper, as it's applied to binary changeset strings, thus cutting them short (because of strlen).
1 parent f25beb3 commit 5c1fdc9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tool/net/lsqlite3.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,7 +2312,7 @@ static int db_concat_changeset(lua_State *L) {
23122312
int rc = sqlite3changegroup_new(&pGrp);
23132313
for (int i = 1; rc == SQLITE_OK && i <= n; i++) {
23142314
lua_rawgeti(L, 2, i);
2315-
cset = gc(strdup(lua_tostring(L, -1)));
2315+
cset = (void *)lua_tostring(L, -1);
23162316
nset = lua_rawlen(L, -1);
23172317
rc = sqlite3changegroup_add(pGrp, nset, cset);
23182318
lua_pop(L, 1); // pop the string
@@ -2328,7 +2328,7 @@ static int db_concat_changeset(lua_State *L) {
23282328

23292329
static int db_apply_changeset(lua_State *L) {
23302330
sdb *db = lsqlite_checkdb(L, 1);
2331-
char *cset = gc(strdup(luaL_checkstring(L, 2)));
2331+
void *cset = (void *)luaL_checkstring(L, 2);
23322332
int nset = lua_rawlen(L, 2);
23332333
int top = lua_gettop(L);
23342334
int rc;

0 commit comments

Comments
 (0)