Fossil SCM

Fix a memory leak that was preventing massive check-ins.

drh 2009-02-26 01:21 trunk
Commit f6790b7c3cc237fac3d0cc064cb262d50fa12265
1 file changed +4 -1
+4 -1
--- src/checkin.c
+++ src/checkin.c
@@ -409,10 +409,11 @@
409409
int forceFlag = 0; /* Force a fork */
410410
char *zManifestFile; /* Name of the manifest file */
411411
int nBasename; /* Length of "g.zLocalRoot/" */
412412
const char *zBranch; /* Create a new branch with this name */
413413
const char *zBgColor; /* Set background color when branching */
414
+ const char *zDateOvrd; /* Override date string */
414415
Blob filename; /* complete filename */
415416
Blob manifest;
416417
Blob muuid; /* Manifest uuid */
417418
Blob mcksum; /* Self-checksum on the manifest */
418419
Blob cksum1, cksum2; /* Before and after commit checksums */
@@ -422,10 +423,11 @@
422423
noSign = find_option("nosign",0,0)!=0;
423424
zComment = find_option("comment","m",1);
424425
forceFlag = find_option("force", "f", 0)!=0;
425426
zBranch = find_option("branch","b",1);
426427
zBgColor = find_option("bgcolor",0,1);
428
+ zDateOvrd = find_option("date-override",0,1);
427429
db_must_be_within_tree();
428430
noSign = db_get_boolean("omitsign", 0)|noSign;
429431
if( db_get_boolean("clearsign", 1)==0 ){ noSign = 1; }
430432
verify_all_options();
431433
@@ -535,10 +537,11 @@
535537
rid = db_column_int(&q, 2);
536538
537539
blob_zero(&content);
538540
blob_read_from_file(&content, zFullname);
539541
nrid = content_put(&content, 0, 0);
542
+ blob_reset(&content);
540543
if( rid>0 ){
541544
content_deltify(rid, nrid, 0);
542545
}
543546
db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id);
544547
db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
@@ -549,11 +552,11 @@
549552
blob_zero(&manifest);
550553
if( blob_size(&comment)==0 ){
551554
blob_append(&comment, "(no comment)", -1);
552555
}
553556
blob_appendf(&manifest, "C %F\n", blob_str(&comment));
554
- zDate = db_text(0, "SELECT datetime('now')");
557
+ zDate = db_text(0, "SELECT datetime('%q')", zDateOvrd ? zDateOvrd : "now");
555558
zDate[10] = 'T';
556559
blob_appendf(&manifest, "D %s\n", zDate);
557560
db_prepare(&q,
558561
"SELECT pathname, uuid, origname"
559562
" FROM vfile JOIN blob ON vfile.mrid=blob.rid"
560563
--- src/checkin.c
+++ src/checkin.c
@@ -409,10 +409,11 @@
409 int forceFlag = 0; /* Force a fork */
410 char *zManifestFile; /* Name of the manifest file */
411 int nBasename; /* Length of "g.zLocalRoot/" */
412 const char *zBranch; /* Create a new branch with this name */
413 const char *zBgColor; /* Set background color when branching */
 
414 Blob filename; /* complete filename */
415 Blob manifest;
416 Blob muuid; /* Manifest uuid */
417 Blob mcksum; /* Self-checksum on the manifest */
418 Blob cksum1, cksum2; /* Before and after commit checksums */
@@ -422,10 +423,11 @@
422 noSign = find_option("nosign",0,0)!=0;
423 zComment = find_option("comment","m",1);
424 forceFlag = find_option("force", "f", 0)!=0;
425 zBranch = find_option("branch","b",1);
426 zBgColor = find_option("bgcolor",0,1);
 
427 db_must_be_within_tree();
428 noSign = db_get_boolean("omitsign", 0)|noSign;
429 if( db_get_boolean("clearsign", 1)==0 ){ noSign = 1; }
430 verify_all_options();
431
@@ -535,10 +537,11 @@
535 rid = db_column_int(&q, 2);
536
537 blob_zero(&content);
538 blob_read_from_file(&content, zFullname);
539 nrid = content_put(&content, 0, 0);
 
540 if( rid>0 ){
541 content_deltify(rid, nrid, 0);
542 }
543 db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id);
544 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
@@ -549,11 +552,11 @@
549 blob_zero(&manifest);
550 if( blob_size(&comment)==0 ){
551 blob_append(&comment, "(no comment)", -1);
552 }
553 blob_appendf(&manifest, "C %F\n", blob_str(&comment));
554 zDate = db_text(0, "SELECT datetime('now')");
555 zDate[10] = 'T';
556 blob_appendf(&manifest, "D %s\n", zDate);
557 db_prepare(&q,
558 "SELECT pathname, uuid, origname"
559 " FROM vfile JOIN blob ON vfile.mrid=blob.rid"
560
--- src/checkin.c
+++ src/checkin.c
@@ -409,10 +409,11 @@
409 int forceFlag = 0; /* Force a fork */
410 char *zManifestFile; /* Name of the manifest file */
411 int nBasename; /* Length of "g.zLocalRoot/" */
412 const char *zBranch; /* Create a new branch with this name */
413 const char *zBgColor; /* Set background color when branching */
414 const char *zDateOvrd; /* Override date string */
415 Blob filename; /* complete filename */
416 Blob manifest;
417 Blob muuid; /* Manifest uuid */
418 Blob mcksum; /* Self-checksum on the manifest */
419 Blob cksum1, cksum2; /* Before and after commit checksums */
@@ -422,10 +423,11 @@
423 noSign = find_option("nosign",0,0)!=0;
424 zComment = find_option("comment","m",1);
425 forceFlag = find_option("force", "f", 0)!=0;
426 zBranch = find_option("branch","b",1);
427 zBgColor = find_option("bgcolor",0,1);
428 zDateOvrd = find_option("date-override",0,1);
429 db_must_be_within_tree();
430 noSign = db_get_boolean("omitsign", 0)|noSign;
431 if( db_get_boolean("clearsign", 1)==0 ){ noSign = 1; }
432 verify_all_options();
433
@@ -535,10 +537,11 @@
537 rid = db_column_int(&q, 2);
538
539 blob_zero(&content);
540 blob_read_from_file(&content, zFullname);
541 nrid = content_put(&content, 0, 0);
542 blob_reset(&content);
543 if( rid>0 ){
544 content_deltify(rid, nrid, 0);
545 }
546 db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d WHERE id=%d", nrid,nrid,id);
547 db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid);
@@ -549,11 +552,11 @@
552 blob_zero(&manifest);
553 if( blob_size(&comment)==0 ){
554 blob_append(&comment, "(no comment)", -1);
555 }
556 blob_appendf(&manifest, "C %F\n", blob_str(&comment));
557 zDate = db_text(0, "SELECT datetime('%q')", zDateOvrd ? zDateOvrd : "now");
558 zDate[10] = 'T';
559 blob_appendf(&manifest, "D %s\n", zDate);
560 db_prepare(&q,
561 "SELECT pathname, uuid, origname"
562 " FROM vfile JOIN blob ON vfile.mrid=blob.rid"
563

Keyboard Shortcuts

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