Fossil

Check-in [d60dd7afb0]
Login

Check-in [d60dd7afb0]

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

Overview
Comment:Removed the cleanup of g.zXYZ because there's simply too high of a chance that future changes would turn one of those free() calls into a double-free or passing an invalid pointer to free().
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | memleak-fixes
Files: files | file ages | folders
SHA3-256: d60dd7afb02d16b6816bee67995c1bcd5d1e8c995d1a6bc419736fce90e25367
User & Date: stephan 2019-12-20 15:41:44.684
Context
2019-12-21
03:45
Removed fossil_atexit_free_this() because it effectively costs more static memory than it cleans up in dynamic memory. ... (check-in: 99cb2ccd94 user: stephan tags: memleak-fixes)
2019-12-20
15:41
Removed the cleanup of g.zXYZ because there's simply too high of a chance that future changes would turn one of those free() calls into a double-free or passing an invalid pointer to free(). ... (check-in: d60dd7afb0 user: stephan tags: memleak-fixes)
00:59
atexit: no longer freeing about half of g.zXYZ because they're not always safe to free (sometimes they point to each other or are substrings of other strings). ... (check-in: 5f36a86a73 user: stephan tags: memleak-fixes)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
#ifdef FOSSIL_ENABLE_JSON
  cson_value_free(g.json.gc.v);
  memset(&g.json, 0, sizeof(g.json));
#endif
  if(g.db){
    db_close(0);
  }
  fossil_free(g.ckinLockFail);
  fossil_free(g.zAuxSchema);
  fossil_free(g.zConfigDbName);
  fossil_free(g.zErrMsg);
  fossil_free(g.zHttpAuth);
  fossil_free(g.zIpAddr);
  fossil_free(g.zLocalDbName);
  fossil_free(g.zLocalRoot);
  fossil_free(g.zNonce);
  fossil_free(g.zSshCmd);
#define never_free(x)
  never_free(g.zTop/* sometimes part of another string */);
  never_free(g.zPath /* sometimes part of another string */);
  never_free(g.zBaseURL /* might be the same as g.zTop */);
  never_free(g.zRepositoryOption/* sometimes static */);
  never_free(g.zRepositoryName /* sometimes static */);
  never_free(g.zOpenRevision /* sometimes static */);
  never_free(g.zHttpsURL /* sometimes = g.zBaseUrl */);
  never_free(g.zExtra /* might be part of another string */);
#undef never_free
  manifest_clear_cache();
  content_clear_cache(1);
  rebuild_clear_cache();
  if(fossilFreeAtExit.n>0){
    int i;
    for(i = 0; i < fossilFreeAtExit.n; ++i){
      fossil_free(fossilFreeAtExit.list[i]);







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







388
389
390
391
392
393
394




















395
396
397
398
399
400
401
#ifdef FOSSIL_ENABLE_JSON
  cson_value_free(g.json.gc.v);
  memset(&g.json, 0, sizeof(g.json));
#endif
  if(g.db){
    db_close(0);
  }




















  manifest_clear_cache();
  content_clear_cache(1);
  rebuild_clear_cache();
  if(fossilFreeAtExit.n>0){
    int i;
    for(i = 0; i < fossilFreeAtExit.n; ++i){
      fossil_free(fossilFreeAtExit.list[i]);