Fossil SCM
Several memleak fixes reported via https://fossil-scm.org/forum/forumpost/205b004d8a. In a branch so the OP can test them in his setup.
Commit
4566da665ddb4b5f321def7fd67ffc7fbf616d8666adee6e5bc5db5654fecf5b
Parent
8628cbd428cb507…
4 files changed
+2
+3
-2
+2
-1
+3
-2
+2
| --- src/import.c | ||
| +++ src/import.c | ||
| @@ -336,10 +336,12 @@ | ||
| 336 | 336 | ** |
| 337 | 337 | ** This behavior seems like a bug in git-fast-export, but it is easier |
| 338 | 338 | ** to work around the problem than to fix git-fast-export. |
| 339 | 339 | */ |
| 340 | 340 | if( gg.tagCommit && gg.zDate && gg.zUser && gg.zFrom ){ |
| 341 | + record.nUsed = 0 | |
| 342 | + /*in case fast_insert_comment() did not indirectly blob_reset() it */; | |
| 341 | 343 | blob_appendf(&record, "D %s\n", gg.zDate); |
| 342 | 344 | blob_appendf(&record, "T +sym-%F%F%F %s\n", gimport.zBranchPre, gg.zBranch, |
| 343 | 345 | gimport.zBranchSuf, gg.zPrevCheckin); |
| 344 | 346 | blob_appendf(&record, "U %F\n", gg.zUser); |
| 345 | 347 | md5sum_blob(&record, &cksum); |
| 346 | 348 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -336,10 +336,12 @@ | |
| 336 | ** |
| 337 | ** This behavior seems like a bug in git-fast-export, but it is easier |
| 338 | ** to work around the problem than to fix git-fast-export. |
| 339 | */ |
| 340 | if( gg.tagCommit && gg.zDate && gg.zUser && gg.zFrom ){ |
| 341 | blob_appendf(&record, "D %s\n", gg.zDate); |
| 342 | blob_appendf(&record, "T +sym-%F%F%F %s\n", gimport.zBranchPre, gg.zBranch, |
| 343 | gimport.zBranchSuf, gg.zPrevCheckin); |
| 344 | blob_appendf(&record, "U %F\n", gg.zUser); |
| 345 | md5sum_blob(&record, &cksum); |
| 346 |
| --- src/import.c | |
| +++ src/import.c | |
| @@ -336,10 +336,12 @@ | |
| 336 | ** |
| 337 | ** This behavior seems like a bug in git-fast-export, but it is easier |
| 338 | ** to work around the problem than to fix git-fast-export. |
| 339 | */ |
| 340 | if( gg.tagCommit && gg.zDate && gg.zUser && gg.zFrom ){ |
| 341 | record.nUsed = 0 |
| 342 | /*in case fast_insert_comment() did not indirectly blob_reset() it */; |
| 343 | blob_appendf(&record, "D %s\n", gg.zDate); |
| 344 | blob_appendf(&record, "T +sym-%F%F%F %s\n", gimport.zBranchPre, gg.zBranch, |
| 345 | gimport.zBranchSuf, gg.zPrevCheckin); |
| 346 | blob_appendf(&record, "U %F\n", gg.zUser); |
| 347 | md5sum_blob(&record, &cksum); |
| 348 |
+3
-2
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -2087,12 +2087,13 @@ | ||
| 2087 | 2087 | if( (p = manifest_cache_find(rid))!=0 ){ |
| 2088 | 2088 | blob_reset(pContent); |
| 2089 | 2089 | }else if( (p = manifest_parse(pContent, rid, 0))==0 ){ |
| 2090 | 2090 | assert( blob_is_reset(pContent) || pContent==0 ); |
| 2091 | 2091 | if( (flags & MC_NO_ERRORS)==0 ){ |
| 2092 | - fossil_error(1, "syntax error in manifest [%S]", | |
| 2093 | - db_text(0, "SELECT uuid FROM blob WHERE rid=%d",rid)); | |
| 2092 | + char * zErrUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d",rid); | |
| 2093 | + fossil_error(1, "syntax error in manifest [%S]", zErrUuid); | |
| 2094 | + fossil_free(zErrUuid); | |
| 2094 | 2095 | } |
| 2095 | 2096 | return 0; |
| 2096 | 2097 | } |
| 2097 | 2098 | if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){ |
| 2098 | 2099 | manifest_destroy(p); |
| 2099 | 2100 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -2087,12 +2087,13 @@ | |
| 2087 | if( (p = manifest_cache_find(rid))!=0 ){ |
| 2088 | blob_reset(pContent); |
| 2089 | }else if( (p = manifest_parse(pContent, rid, 0))==0 ){ |
| 2090 | assert( blob_is_reset(pContent) || pContent==0 ); |
| 2091 | if( (flags & MC_NO_ERRORS)==0 ){ |
| 2092 | fossil_error(1, "syntax error in manifest [%S]", |
| 2093 | db_text(0, "SELECT uuid FROM blob WHERE rid=%d",rid)); |
| 2094 | } |
| 2095 | return 0; |
| 2096 | } |
| 2097 | if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){ |
| 2098 | manifest_destroy(p); |
| 2099 |
| --- src/manifest.c | |
| +++ src/manifest.c | |
| @@ -2087,12 +2087,13 @@ | |
| 2087 | if( (p = manifest_cache_find(rid))!=0 ){ |
| 2088 | blob_reset(pContent); |
| 2089 | }else if( (p = manifest_parse(pContent, rid, 0))==0 ){ |
| 2090 | assert( blob_is_reset(pContent) || pContent==0 ); |
| 2091 | if( (flags & MC_NO_ERRORS)==0 ){ |
| 2092 | char * zErrUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d",rid); |
| 2093 | fossil_error(1, "syntax error in manifest [%S]", zErrUuid); |
| 2094 | fossil_free(zErrUuid); |
| 2095 | } |
| 2096 | return 0; |
| 2097 | } |
| 2098 | if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){ |
| 2099 | manifest_destroy(p); |
| 2100 |
+2
-1
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -364,11 +364,11 @@ | ||
| 364 | 364 | |
| 365 | 365 | /* |
| 366 | 366 | ** Recreate the TICKET and TICKETCHNG tables. |
| 367 | 367 | */ |
| 368 | 368 | void ticket_create_table(int separateConnection){ |
| 369 | - const char *zSql; | |
| 369 | + char *zSql; | |
| 370 | 370 | |
| 371 | 371 | db_multi_exec( |
| 372 | 372 | "DROP TABLE IF EXISTS ticket;" |
| 373 | 373 | "DROP TABLE IF EXISTS ticketchng;" |
| 374 | 374 | ); |
| @@ -377,10 +377,11 @@ | ||
| 377 | 377 | if( db_transaction_nesting_depth() ) db_end_transaction(0); |
| 378 | 378 | db_init_database(g.zRepositoryName, zSql, 0); |
| 379 | 379 | }else{ |
| 380 | 380 | db_multi_exec("%s", zSql/*safe-for-%s*/); |
| 381 | 381 | } |
| 382 | + fossil_free(zSql); | |
| 382 | 383 | } |
| 383 | 384 | |
| 384 | 385 | /* |
| 385 | 386 | ** Repopulate the TICKET and TICKETCHNG tables from scratch using all |
| 386 | 387 | ** available ticket artifacts. |
| 387 | 388 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -364,11 +364,11 @@ | |
| 364 | |
| 365 | /* |
| 366 | ** Recreate the TICKET and TICKETCHNG tables. |
| 367 | */ |
| 368 | void ticket_create_table(int separateConnection){ |
| 369 | const char *zSql; |
| 370 | |
| 371 | db_multi_exec( |
| 372 | "DROP TABLE IF EXISTS ticket;" |
| 373 | "DROP TABLE IF EXISTS ticketchng;" |
| 374 | ); |
| @@ -377,10 +377,11 @@ | |
| 377 | if( db_transaction_nesting_depth() ) db_end_transaction(0); |
| 378 | db_init_database(g.zRepositoryName, zSql, 0); |
| 379 | }else{ |
| 380 | db_multi_exec("%s", zSql/*safe-for-%s*/); |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | /* |
| 385 | ** Repopulate the TICKET and TICKETCHNG tables from scratch using all |
| 386 | ** available ticket artifacts. |
| 387 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -364,11 +364,11 @@ | |
| 364 | |
| 365 | /* |
| 366 | ** Recreate the TICKET and TICKETCHNG tables. |
| 367 | */ |
| 368 | void ticket_create_table(int separateConnection){ |
| 369 | char *zSql; |
| 370 | |
| 371 | db_multi_exec( |
| 372 | "DROP TABLE IF EXISTS ticket;" |
| 373 | "DROP TABLE IF EXISTS ticketchng;" |
| 374 | ); |
| @@ -377,10 +377,11 @@ | |
| 377 | if( db_transaction_nesting_depth() ) db_end_transaction(0); |
| 378 | db_init_database(g.zRepositoryName, zSql, 0); |
| 379 | }else{ |
| 380 | db_multi_exec("%s", zSql/*safe-for-%s*/); |
| 381 | } |
| 382 | fossil_free(zSql); |
| 383 | } |
| 384 | |
| 385 | /* |
| 386 | ** Repopulate the TICKET and TICKETCHNG tables from scratch using all |
| 387 | ** available ticket artifacts. |
| 388 |
+3
-2
| --- src/tktsetup.c | ||
| +++ src/tktsetup.c | ||
| @@ -96,13 +96,14 @@ | ||
| 96 | 96 | @ ); |
| 97 | 97 | @ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime); |
| 98 | 98 | ; |
| 99 | 99 | |
| 100 | 100 | /* |
| 101 | -** Return the ticket table definition | |
| 101 | +** Return the ticket table definition in heap-allocated | |
| 102 | +** memory owned by the caller. | |
| 102 | 103 | */ |
| 103 | -const char *ticket_table_schema(void){ | |
| 104 | +char *ticket_table_schema(void){ | |
| 104 | 105 | return db_get("ticket-table", zDefaultTicketTable); |
| 105 | 106 | } |
| 106 | 107 | |
| 107 | 108 | /* |
| 108 | 109 | ** Common implementation for the ticket setup editor pages. |
| 109 | 110 |
| --- src/tktsetup.c | |
| +++ src/tktsetup.c | |
| @@ -96,13 +96,14 @@ | |
| 96 | @ ); |
| 97 | @ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime); |
| 98 | ; |
| 99 | |
| 100 | /* |
| 101 | ** Return the ticket table definition |
| 102 | */ |
| 103 | const char *ticket_table_schema(void){ |
| 104 | return db_get("ticket-table", zDefaultTicketTable); |
| 105 | } |
| 106 | |
| 107 | /* |
| 108 | ** Common implementation for the ticket setup editor pages. |
| 109 |
| --- src/tktsetup.c | |
| +++ src/tktsetup.c | |
| @@ -96,13 +96,14 @@ | |
| 96 | @ ); |
| 97 | @ CREATE INDEX ticketchng_idx1 ON ticketchng(tkt_id, tkt_mtime); |
| 98 | ; |
| 99 | |
| 100 | /* |
| 101 | ** Return the ticket table definition in heap-allocated |
| 102 | ** memory owned by the caller. |
| 103 | */ |
| 104 | char *ticket_table_schema(void){ |
| 105 | return db_get("ticket-table", zDefaultTicketTable); |
| 106 | } |
| 107 | |
| 108 | /* |
| 109 | ** Common implementation for the ticket setup editor pages. |
| 110 |