Fossil SCM

Clean up g.non-const zXYZ members in the atexit handler. Add a blob_reset() in finish_tag() to cover the case that fast_insert_content() does not reset it.

stephan 2019-12-19 20:41 memleak-fixes
Commit 252ca35f47a91f27846926f99362a376aae3d392e77236df3a15fd7f5bb4d8db
2 files changed +1 +20 -1
--- src/import.c
+++ src/import.c
@@ -226,10 +226,11 @@
226226
blob_appendf(&record, "\nU %F\n", gg.zUser);
227227
md5sum_blob(&record, &cksum);
228228
blob_appendf(&record, "Z %b\n", &cksum);
229229
fast_insert_content(&record, 0, 0, 1);
230230
blob_reset(&cksum);
231
+ blob_reset(&record);
231232
}
232233
import_reset(0);
233234
}
234235
235236
/*
236237
--- src/import.c
+++ src/import.c
@@ -226,10 +226,11 @@
226 blob_appendf(&record, "\nU %F\n", gg.zUser);
227 md5sum_blob(&record, &cksum);
228 blob_appendf(&record, "Z %b\n", &cksum);
229 fast_insert_content(&record, 0, 0, 1);
230 blob_reset(&cksum);
 
231 }
232 import_reset(0);
233 }
234
235 /*
236
--- src/import.c
+++ src/import.c
@@ -226,10 +226,11 @@
226 blob_appendf(&record, "\nU %F\n", gg.zUser);
227 md5sum_blob(&record, &cksum);
228 blob_appendf(&record, "Z %b\n", &cksum);
229 fast_insert_content(&record, 0, 0, 1);
230 blob_reset(&cksum);
231 blob_reset(&record);
232 }
233 import_reset(0);
234 }
235
236 /*
237
+20 -1
--- src/main.c
+++ src/main.c
@@ -360,14 +360,33 @@
360360
#endif
361361
#ifdef FOSSIL_ENABLE_JSON
362362
cson_value_free(g.json.gc.v);
363363
memset(&g.json, 0, sizeof(g.json));
364364
#endif
365
- free(g.zErrMsg);
366365
if(g.db){
367366
db_close(0);
368367
}
368
+ fossil_free(g.ckinLockFail);
369
+ fossil_free(g.zAuxSchema);
370
+ fossil_free(g.zBaseURL);
371
+ fossil_free(g.zConfigDbName);
372
+ fossil_free(g.zErrMsg);
373
+ fossil_free(g.zExtra);
374
+ fossil_free(g.zHttpAuth);
375
+ fossil_free(g.zHttpsURL);
376
+ fossil_free(g.zIpAddr);
377
+ fossil_free(g.zLocalDbName);
378
+ fossil_free(g.zLocalRoot);
379
+ fossil_free(g.zNonce);
380
+ fossil_free(g.zOpenRevision);
381
+ fossil_free(g.zPath);
382
+ fossil_free(g.zRepositoryName);
383
+ fossil_free(g.zRepositoryOption);
384
+ fossil_free(g.zSshCmd);
385
+ fossil_free(g.zTop);
386
+ /* TODO: clean up the file-local content.c::contentCache
387
+ ** via new function in that file */
369388
/*
370389
** FIXME: The next two lines cannot always be enabled; however, they
371390
** are very useful for tracking down TH1 memory leaks.
372391
*/
373392
if( fossil_getenv("TH1_DELETE_INTERP")!=0 ){
374393
--- src/main.c
+++ src/main.c
@@ -360,14 +360,33 @@
360 #endif
361 #ifdef FOSSIL_ENABLE_JSON
362 cson_value_free(g.json.gc.v);
363 memset(&g.json, 0, sizeof(g.json));
364 #endif
365 free(g.zErrMsg);
366 if(g.db){
367 db_close(0);
368 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
369 /*
370 ** FIXME: The next two lines cannot always be enabled; however, they
371 ** are very useful for tracking down TH1 memory leaks.
372 */
373 if( fossil_getenv("TH1_DELETE_INTERP")!=0 ){
374
--- src/main.c
+++ src/main.c
@@ -360,14 +360,33 @@
360 #endif
361 #ifdef FOSSIL_ENABLE_JSON
362 cson_value_free(g.json.gc.v);
363 memset(&g.json, 0, sizeof(g.json));
364 #endif
 
365 if(g.db){
366 db_close(0);
367 }
368 fossil_free(g.ckinLockFail);
369 fossil_free(g.zAuxSchema);
370 fossil_free(g.zBaseURL);
371 fossil_free(g.zConfigDbName);
372 fossil_free(g.zErrMsg);
373 fossil_free(g.zExtra);
374 fossil_free(g.zHttpAuth);
375 fossil_free(g.zHttpsURL);
376 fossil_free(g.zIpAddr);
377 fossil_free(g.zLocalDbName);
378 fossil_free(g.zLocalRoot);
379 fossil_free(g.zNonce);
380 fossil_free(g.zOpenRevision);
381 fossil_free(g.zPath);
382 fossil_free(g.zRepositoryName);
383 fossil_free(g.zRepositoryOption);
384 fossil_free(g.zSshCmd);
385 fossil_free(g.zTop);
386 /* TODO: clean up the file-local content.c::contentCache
387 ** via new function in that file */
388 /*
389 ** FIXME: The next two lines cannot always be enabled; however, they
390 ** are very useful for tracking down TH1 memory leaks.
391 */
392 if( fossil_getenv("TH1_DELETE_INTERP")!=0 ){
393

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button