Fossil SCM
What I did to get the 'annotate' command not leak. Notice that I disabled again the check for blob_is_reset, as in trunk.
Commit
7ad4dfbe8b6757e368ac4c488601649a07d8c16b
Parent
0f9fb203703ff21…
6 files changed
+1
-1
+2
-2
+1
-1
+1
-1
+4
-4
+1
-1
+1
-1
| --- src/blob.c | ||
| +++ src/blob.c | ||
| @@ -894,11 +894,11 @@ | ||
| 894 | 894 | */ |
| 895 | 895 | int blob_uncompress(Blob *pIn, Blob *pOut){ |
| 896 | 896 | unsigned int nOut; |
| 897 | 897 | unsigned char *inBuf; |
| 898 | 898 | unsigned int nIn = blob_size(pIn); |
| 899 | - Blob temp; | |
| 899 | + Blob temp = empty_blob; | |
| 900 | 900 | int rc; |
| 901 | 901 | unsigned long int nOut2; |
| 902 | 902 | if( nIn<=4 ){ |
| 903 | 903 | return 0; |
| 904 | 904 | } |
| 905 | 905 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -894,11 +894,11 @@ | |
| 894 | */ |
| 895 | int blob_uncompress(Blob *pIn, Blob *pOut){ |
| 896 | unsigned int nOut; |
| 897 | unsigned char *inBuf; |
| 898 | unsigned int nIn = blob_size(pIn); |
| 899 | Blob temp; |
| 900 | int rc; |
| 901 | unsigned long int nOut2; |
| 902 | if( nIn<=4 ){ |
| 903 | return 0; |
| 904 | } |
| 905 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -894,11 +894,11 @@ | |
| 894 | */ |
| 895 | int blob_uncompress(Blob *pIn, Blob *pOut){ |
| 896 | unsigned int nOut; |
| 897 | unsigned char *inBuf; |
| 898 | unsigned int nIn = blob_size(pIn); |
| 899 | Blob temp = empty_blob; |
| 900 | int rc; |
| 901 | unsigned long int nOut2; |
| 902 | if( nIn<=4 ){ |
| 903 | return 0; |
| 904 | } |
| 905 |
+2
-2
| --- src/content.c | ||
| +++ src/content.c | ||
| @@ -95,11 +95,11 @@ | ||
| 95 | 95 | p = &contentCache.a[contentCache.n++]; |
| 96 | 96 | p->rid = rid; |
| 97 | 97 | p->age = contentCache.nextAge++; |
| 98 | 98 | contentCache.szTotal += blob_size(pBlob); |
| 99 | 99 | p->content = *pBlob; |
| 100 | - blob_zero(pBlob); | |
| 100 | + blob_reset(pBlob); | |
| 101 | 101 | bag_insert(&contentCache.inCache, rid); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /* |
| 105 | 105 | ** Clear the content cache. |
| @@ -259,11 +259,11 @@ | ||
| 259 | 259 | }else{ |
| 260 | 260 | int n = 1; |
| 261 | 261 | int nAlloc = 10; |
| 262 | 262 | int *a = 0; |
| 263 | 263 | int mx; |
| 264 | - Blob delta, next; | |
| 264 | + Blob delta = empty_blob, next = empty_blob; | |
| 265 | 265 | |
| 266 | 266 | a = fossil_malloc( sizeof(a[0])*nAlloc ); |
| 267 | 267 | a[0] = rid; |
| 268 | 268 | a[1] = nextRid; |
| 269 | 269 | n = 1; |
| 270 | 270 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -95,11 +95,11 @@ | |
| 95 | p = &contentCache.a[contentCache.n++]; |
| 96 | p->rid = rid; |
| 97 | p->age = contentCache.nextAge++; |
| 98 | contentCache.szTotal += blob_size(pBlob); |
| 99 | p->content = *pBlob; |
| 100 | blob_zero(pBlob); |
| 101 | bag_insert(&contentCache.inCache, rid); |
| 102 | } |
| 103 | |
| 104 | /* |
| 105 | ** Clear the content cache. |
| @@ -259,11 +259,11 @@ | |
| 259 | }else{ |
| 260 | int n = 1; |
| 261 | int nAlloc = 10; |
| 262 | int *a = 0; |
| 263 | int mx; |
| 264 | Blob delta, next; |
| 265 | |
| 266 | a = fossil_malloc( sizeof(a[0])*nAlloc ); |
| 267 | a[0] = rid; |
| 268 | a[1] = nextRid; |
| 269 | n = 1; |
| 270 |
| --- src/content.c | |
| +++ src/content.c | |
| @@ -95,11 +95,11 @@ | |
| 95 | p = &contentCache.a[contentCache.n++]; |
| 96 | p->rid = rid; |
| 97 | p->age = contentCache.nextAge++; |
| 98 | contentCache.szTotal += blob_size(pBlob); |
| 99 | p->content = *pBlob; |
| 100 | blob_reset(pBlob); |
| 101 | bag_insert(&contentCache.inCache, rid); |
| 102 | } |
| 103 | |
| 104 | /* |
| 105 | ** Clear the content cache. |
| @@ -259,11 +259,11 @@ | |
| 259 | }else{ |
| 260 | int n = 1; |
| 261 | int nAlloc = 10; |
| 262 | int *a = 0; |
| 263 | int mx; |
| 264 | Blob delta = empty_blob, next = empty_blob; |
| 265 | |
| 266 | a = fossil_malloc( sizeof(a[0])*nAlloc ); |
| 267 | a[0] = rid; |
| 268 | a[1] = nextRid; |
| 269 | n = 1; |
| 270 |
M
src/db.c
+1
-1
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -211,11 +211,11 @@ | ||
| 211 | 211 | ** one is processed. All statements beyond the first are silently ignored. |
| 212 | 212 | */ |
| 213 | 213 | int db_vprepare(Stmt *pStmt, int errOk, const char *zFormat, va_list ap){ |
| 214 | 214 | int rc; |
| 215 | 215 | char *zSql; |
| 216 | - blob_zero(&pStmt->sql); | |
| 216 | + pStmt->sql = empty_blob; | |
| 217 | 217 | blob_vappendf(&pStmt->sql, zFormat, ap); |
| 218 | 218 | va_end(ap); |
| 219 | 219 | zSql = blob_str(&pStmt->sql); |
| 220 | 220 | nPrepare++; |
| 221 | 221 | rc = sqlite3_prepare_v2(g.db, zSql, -1, &pStmt->pStmt, 0); |
| 222 | 222 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -211,11 +211,11 @@ | |
| 211 | ** one is processed. All statements beyond the first are silently ignored. |
| 212 | */ |
| 213 | int db_vprepare(Stmt *pStmt, int errOk, const char *zFormat, va_list ap){ |
| 214 | int rc; |
| 215 | char *zSql; |
| 216 | blob_zero(&pStmt->sql); |
| 217 | blob_vappendf(&pStmt->sql, zFormat, ap); |
| 218 | va_end(ap); |
| 219 | zSql = blob_str(&pStmt->sql); |
| 220 | nPrepare++; |
| 221 | rc = sqlite3_prepare_v2(g.db, zSql, -1, &pStmt->pStmt, 0); |
| 222 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -211,11 +211,11 @@ | |
| 211 | ** one is processed. All statements beyond the first are silently ignored. |
| 212 | */ |
| 213 | int db_vprepare(Stmt *pStmt, int errOk, const char *zFormat, va_list ap){ |
| 214 | int rc; |
| 215 | char *zSql; |
| 216 | pStmt->sql = empty_blob; |
| 217 | blob_vappendf(&pStmt->sql, zFormat, ap); |
| 218 | va_end(ap); |
| 219 | zSql = blob_str(&pStmt->sql); |
| 220 | nPrepare++; |
| 221 | rc = sqlite3_prepare_v2(g.db, zSql, -1, &pStmt->pStmt, 0); |
| 222 |
+1
-1
| --- src/deltacmd.c | ||
| +++ src/deltacmd.c | ||
| @@ -77,11 +77,11 @@ | ||
| 77 | 77 | ** |
| 78 | 78 | ** Return the length of the target. Return -1 if there is an error. |
| 79 | 79 | */ |
| 80 | 80 | int blob_delta_apply(Blob *pOriginal, Blob *pDelta, Blob *pTarget){ |
| 81 | 81 | int len, n; |
| 82 | - Blob out; | |
| 82 | + Blob out = empty_blob; | |
| 83 | 83 | |
| 84 | 84 | n = delta_output_size(blob_buffer(pDelta), blob_size(pDelta)); |
| 85 | 85 | blob_zero(&out); |
| 86 | 86 | if( n<0 ) return -1; |
| 87 | 87 | blob_resize(&out, n); |
| 88 | 88 |
| --- src/deltacmd.c | |
| +++ src/deltacmd.c | |
| @@ -77,11 +77,11 @@ | |
| 77 | ** |
| 78 | ** Return the length of the target. Return -1 if there is an error. |
| 79 | */ |
| 80 | int blob_delta_apply(Blob *pOriginal, Blob *pDelta, Blob *pTarget){ |
| 81 | int len, n; |
| 82 | Blob out; |
| 83 | |
| 84 | n = delta_output_size(blob_buffer(pDelta), blob_size(pDelta)); |
| 85 | blob_zero(&out); |
| 86 | if( n<0 ) return -1; |
| 87 | blob_resize(&out, n); |
| 88 |
| --- src/deltacmd.c | |
| +++ src/deltacmd.c | |
| @@ -77,11 +77,11 @@ | |
| 77 | ** |
| 78 | ** Return the length of the target. Return -1 if there is an error. |
| 79 | */ |
| 80 | int blob_delta_apply(Blob *pOriginal, Blob *pDelta, Blob *pTarget){ |
| 81 | int len, n; |
| 82 | Blob out = empty_blob; |
| 83 | |
| 84 | n = delta_output_size(blob_buffer(pDelta), blob_size(pDelta)); |
| 85 | blob_zero(&out); |
| 86 | if( n<0 ) return -1; |
| 87 | blob_resize(&out, n); |
| 88 |
+4
-4
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -711,11 +711,11 @@ | ||
| 711 | 711 | p->c.nEdit = 0; |
| 712 | 712 | p->c.nEditAlloc = 0; |
| 713 | 713 | |
| 714 | 714 | /* Clear out the from file */ |
| 715 | 715 | free(p->c.aFrom); |
| 716 | - blob_zero(pParent); | |
| 716 | + blob_reset(pParent); | |
| 717 | 717 | |
| 718 | 718 | /* Return no errors */ |
| 719 | 719 | return 0; |
| 720 | 720 | } |
| 721 | 721 | |
| @@ -763,12 +763,12 @@ | ||
| 763 | 763 | int mid, /* Use the version of the file in this check-in */ |
| 764 | 764 | int webLabel, /* Use web-style annotations if true */ |
| 765 | 765 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 766 | 766 | int annFlags /* Flags to alter the annotation */ |
| 767 | 767 | ){ |
| 768 | - Blob toAnnotate; /* Text of the final (mid) version of the file */ | |
| 769 | - Blob step; /* Text of previous revision */ | |
| 768 | + Blob toAnnotate = empty_blob; /* Text of the final (mid) version of the file */ | |
| 769 | + Blob step = empty_blob; /* Text of previous revision */ | |
| 770 | 770 | int rid; /* Artifact ID of the file being annotated */ |
| 771 | 771 | char *zLabel; /* Label to apply to a line */ |
| 772 | 772 | Stmt q; /* Query returning all ancestor versions */ |
| 773 | 773 | |
| 774 | 774 | /* Initialize the annotation */ |
| @@ -885,11 +885,11 @@ | ||
| 885 | 885 | */ |
| 886 | 886 | void annotate_cmd(void){ |
| 887 | 887 | int fnid; /* Filename ID */ |
| 888 | 888 | int fid; /* File instance ID */ |
| 889 | 889 | int mid; /* Manifest where file was checked in */ |
| 890 | - Blob treename; /* FILENAME translated to canonical form */ | |
| 890 | + Blob treename = empty_blob; /* FILENAME translated to canonical form */ | |
| 891 | 891 | char *zFilename; /* Cannonical filename */ |
| 892 | 892 | Annotator ann; /* The annotation of the file */ |
| 893 | 893 | int i; /* Loop counter */ |
| 894 | 894 | const char *zLimit; /* The value to the --limit option */ |
| 895 | 895 | int iLimit; /* How far back in time to look */ |
| 896 | 896 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -711,11 +711,11 @@ | |
| 711 | p->c.nEdit = 0; |
| 712 | p->c.nEditAlloc = 0; |
| 713 | |
| 714 | /* Clear out the from file */ |
| 715 | free(p->c.aFrom); |
| 716 | blob_zero(pParent); |
| 717 | |
| 718 | /* Return no errors */ |
| 719 | return 0; |
| 720 | } |
| 721 | |
| @@ -763,12 +763,12 @@ | |
| 763 | int mid, /* Use the version of the file in this check-in */ |
| 764 | int webLabel, /* Use web-style annotations if true */ |
| 765 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 766 | int annFlags /* Flags to alter the annotation */ |
| 767 | ){ |
| 768 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 769 | Blob step; /* Text of previous revision */ |
| 770 | int rid; /* Artifact ID of the file being annotated */ |
| 771 | char *zLabel; /* Label to apply to a line */ |
| 772 | Stmt q; /* Query returning all ancestor versions */ |
| 773 | |
| 774 | /* Initialize the annotation */ |
| @@ -885,11 +885,11 @@ | |
| 885 | */ |
| 886 | void annotate_cmd(void){ |
| 887 | int fnid; /* Filename ID */ |
| 888 | int fid; /* File instance ID */ |
| 889 | int mid; /* Manifest where file was checked in */ |
| 890 | Blob treename; /* FILENAME translated to canonical form */ |
| 891 | char *zFilename; /* Cannonical filename */ |
| 892 | Annotator ann; /* The annotation of the file */ |
| 893 | int i; /* Loop counter */ |
| 894 | const char *zLimit; /* The value to the --limit option */ |
| 895 | int iLimit; /* How far back in time to look */ |
| 896 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -711,11 +711,11 @@ | |
| 711 | p->c.nEdit = 0; |
| 712 | p->c.nEditAlloc = 0; |
| 713 | |
| 714 | /* Clear out the from file */ |
| 715 | free(p->c.aFrom); |
| 716 | blob_reset(pParent); |
| 717 | |
| 718 | /* Return no errors */ |
| 719 | return 0; |
| 720 | } |
| 721 | |
| @@ -763,12 +763,12 @@ | |
| 763 | int mid, /* Use the version of the file in this check-in */ |
| 764 | int webLabel, /* Use web-style annotations if true */ |
| 765 | int iLimit, /* Limit the number of levels if greater than zero */ |
| 766 | int annFlags /* Flags to alter the annotation */ |
| 767 | ){ |
| 768 | Blob toAnnotate = empty_blob; /* Text of the final (mid) version of the file */ |
| 769 | Blob step = empty_blob; /* Text of previous revision */ |
| 770 | int rid; /* Artifact ID of the file being annotated */ |
| 771 | char *zLabel; /* Label to apply to a line */ |
| 772 | Stmt q; /* Query returning all ancestor versions */ |
| 773 | |
| 774 | /* Initialize the annotation */ |
| @@ -885,11 +885,11 @@ | |
| 885 | */ |
| 886 | void annotate_cmd(void){ |
| 887 | int fnid; /* Filename ID */ |
| 888 | int fid; /* File instance ID */ |
| 889 | int mid; /* Manifest where file was checked in */ |
| 890 | Blob treename = empty_blob; /* FILENAME translated to canonical form */ |
| 891 | char *zFilename; /* Cannonical filename */ |
| 892 | Annotator ann; /* The annotation of the file */ |
| 893 | int i; /* Loop counter */ |
| 894 | const char *zLimit; /* The value to the --limit option */ |
| 895 | int iLimit; /* How far back in time to look */ |
| 896 |
+1
-1
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -706,11 +706,11 @@ | ||
| 706 | 706 | ** |
| 707 | 707 | ** The root of the tree is defined by the g.zLocalRoot variable. |
| 708 | 708 | */ |
| 709 | 709 | int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){ |
| 710 | 710 | int n; |
| 711 | - Blob full; | |
| 711 | + Blob full = empty_blob; | |
| 712 | 712 | int nFull; |
| 713 | 713 | char *zFull; |
| 714 | 714 | |
| 715 | 715 | blob_zero(pOut); |
| 716 | 716 | db_must_be_within_tree(); |
| 717 | 717 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -706,11 +706,11 @@ | |
| 706 | ** |
| 707 | ** The root of the tree is defined by the g.zLocalRoot variable. |
| 708 | */ |
| 709 | int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){ |
| 710 | int n; |
| 711 | Blob full; |
| 712 | int nFull; |
| 713 | char *zFull; |
| 714 | |
| 715 | blob_zero(pOut); |
| 716 | db_must_be_within_tree(); |
| 717 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -706,11 +706,11 @@ | |
| 706 | ** |
| 707 | ** The root of the tree is defined by the g.zLocalRoot variable. |
| 708 | */ |
| 709 | int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){ |
| 710 | int n; |
| 711 | Blob full = empty_blob; |
| 712 | int nFull; |
| 713 | char *zFull; |
| 714 | |
| 715 | blob_zero(pOut); |
| 716 | db_must_be_within_tree(); |
| 717 |