Skip to content

Commit 7ab4d35

Browse files
committed
libsql-sqlite3: Don't use variable length arrays
The C compiler on Windows does not like them...
1 parent e31193b commit 7ab4d35

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

libsql-sqlite3/src/pager.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7842,9 +7842,15 @@ int sqlite3PagerWalInsert(Pager *pPager, unsigned int iFrame, void *pBuf, unsign
78427842
}
78437843
if (iFrame <= mxFrame) {
78447844
unsigned long frame_len = nBuf-24;
7845-
unsigned char current[frame_len];
7845+
unsigned char *current;
7846+
7847+
current = (unsigned char *)sqlite3MallocZero(frame_len);
7848+
if (current == NULL) {
7849+
return SQLITE_NOMEM;
7850+
}
78467851
rc = pPager->wal->methods.xReadFrame(pPager->wal->pData, iFrame, frame_len, current);
78477852
if (rc != SQLITE_OK) {
7853+
sqlite3_free(current);
78487854
return rc;
78497855
}
78507856
int conflict = 0;
@@ -7854,6 +7860,7 @@ int sqlite3PagerWalInsert(Pager *pPager, unsigned int iFrame, void *pBuf, unsign
78547860
if (pConflict) {
78557861
*pConflict = conflict;
78567862
}
7863+
sqlite3_free(current);
78577864
if (conflict) {
78587865
return SQLITE_ERROR;
78597866
}

0 commit comments

Comments
 (0)