SQLite

Check-in [cb874fd873]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix minor memory leak in the dbstat extension that can occur following an attempt to analyze a corrupt database file.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cb874fd87384be397008e953242d5773ef5d64e07c3e1ae352a42a25d70597b4
User & Date: drh 2018-10-29 18:33:42.996
Context
2018-10-29
21:01
Fix a potential assertion fault that can occur while trying to DROP a table from a corrupted database file. (check-in: 147a9429a5 user: drh tags: trunk)
18:33
Fix minor memory leak in the dbstat extension that can occur following an attempt to analyze a corrupt database file. (check-in: cb874fd873 user: drh tags: trunk)
17:08
In the sessions module, avoid collecting rebase data if the user has not requested it. (check-in: de72a773dd user: dan tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/dbstat.c.
250
251
252
253
254
255
256
257

258
259
260
261
262
263
264






265
266
267
268
269
270
271
250
251
252
253
254
255
256

257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277







-
+







+
+
+
+
+
+







    pCsr->iDb = pTab->iDb;
  }

  *ppCursor = (sqlite3_vtab_cursor *)pCsr;
  return SQLITE_OK;
}

static void statClearPage(StatPage *p){
static void statClearCells(StatPage *p){
  int i;
  if( p->aCell ){
    for(i=0; i<p->nCell; i++){
      sqlite3_free(p->aCell[i].aOvfl);
    }
    sqlite3_free(p->aCell);
  }
  p->nCell = 0;
  p->aCell = 0;
}

static void statClearPage(StatPage *p){
  statClearCells(p);
  sqlite3PagerUnref(p->pPg);
  sqlite3_free(p->zPath);
  memset(p, 0, sizeof(StatPage));
}

static void statResetCsr(StatCursor *pCsr){
  int i;
413
414
415
416
417
418
419
420

421
422
423
424
425
426
427
419
420
421
422
423
424
425

426
427
428
429
430
431
432
433







-
+







    }
  }

  return SQLITE_OK;

statPageIsCorrupt:
  p->flags = 0;
  p->nCell = 0;
  statClearCells(p);
  return SQLITE_OK;
}

/*
** Populate the pCsr->iOffset and pCsr->szPage member variables. Based on
** the current value of pCsr->iPageno.
*/