bug report: vspidx_check_rtree and vspidx_find_rtree will be into dead loop when sqlite3_step return error

21 views
Skip to first unread message

bo yang

unread,
Sep 14, 2024, 3:45:37 AMSep 14
to SpatiaLite Users
while (1)
{
/* scrolling the result set rows */
ret = sqlite3_step (stmt);
if (ret == SQLITE_DONE)
break; /* end of result set */
if (ret == SQLITE_ROW)
{
const char *v = (const char *) sqlite3_column_text (stmt, 0);
int len = sqlite3_column_bytes (stmt, 0);
if (rt)
free (rt);
rt = malloc (len + 1);
strcpy (rt, v);
v = (const char *) sqlite3_column_text (stmt, 1);
len = sqlite3_column_bytes (stmt, 1);
if (rg)
free (rg);
rg = malloc (len + 1);
strcpy (rg, v);
count++;
}
else
{
// ------------bug fix ----------------
if (rg != NULL)
free (rg);
if (rt != NULL)
free (rt);

sqlite3_finalize (stmt);
return 0;
}
}
Reply all
Reply to author
Forward
0 new messages