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.

viriketo 2011-09-04 20:41 UTC trunk
Commit 7ad4dfbe8b6757e368ac4c488601649a07d8c16b
+1 -1
--- src/blob.c
+++ src/blob.c
@@ -894,11 +894,11 @@
894894
*/
895895
int blob_uncompress(Blob *pIn, Blob *pOut){
896896
unsigned int nOut;
897897
unsigned char *inBuf;
898898
unsigned int nIn = blob_size(pIn);
899
- Blob temp;
899
+ Blob temp = empty_blob;
900900
int rc;
901901
unsigned long int nOut2;
902902
if( nIn<=4 ){
903903
return 0;
904904
}
905905
--- 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 @@
9595
p = &contentCache.a[contentCache.n++];
9696
p->rid = rid;
9797
p->age = contentCache.nextAge++;
9898
contentCache.szTotal += blob_size(pBlob);
9999
p->content = *pBlob;
100
- blob_zero(pBlob);
100
+ blob_reset(pBlob);
101101
bag_insert(&contentCache.inCache, rid);
102102
}
103103
104104
/*
105105
** Clear the content cache.
@@ -259,11 +259,11 @@
259259
}else{
260260
int n = 1;
261261
int nAlloc = 10;
262262
int *a = 0;
263263
int mx;
264
- Blob delta, next;
264
+ Blob delta = empty_blob, next = empty_blob;
265265
266266
a = fossil_malloc( sizeof(a[0])*nAlloc );
267267
a[0] = rid;
268268
a[1] = nextRid;
269269
n = 1;
270270
--- 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
+1 -1
--- src/db.c
+++ src/db.c
@@ -211,11 +211,11 @@
211211
** one is processed. All statements beyond the first are silently ignored.
212212
*/
213213
int db_vprepare(Stmt *pStmt, int errOk, const char *zFormat, va_list ap){
214214
int rc;
215215
char *zSql;
216
- blob_zero(&pStmt->sql);
216
+ pStmt->sql = empty_blob;
217217
blob_vappendf(&pStmt->sql, zFormat, ap);
218218
va_end(ap);
219219
zSql = blob_str(&pStmt->sql);
220220
nPrepare++;
221221
rc = sqlite3_prepare_v2(g.db, zSql, -1, &pStmt->pStmt, 0);
222222
--- 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 @@
7777
**
7878
** Return the length of the target. Return -1 if there is an error.
7979
*/
8080
int blob_delta_apply(Blob *pOriginal, Blob *pDelta, Blob *pTarget){
8181
int len, n;
82
- Blob out;
82
+ Blob out = empty_blob;
8383
8484
n = delta_output_size(blob_buffer(pDelta), blob_size(pDelta));
8585
blob_zero(&out);
8686
if( n<0 ) return -1;
8787
blob_resize(&out, n);
8888
--- 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 @@
711711
p->c.nEdit = 0;
712712
p->c.nEditAlloc = 0;
713713
714714
/* Clear out the from file */
715715
free(p->c.aFrom);
716
- blob_zero(pParent);
716
+ blob_reset(pParent);
717717
718718
/* Return no errors */
719719
return 0;
720720
}
721721
@@ -763,12 +763,12 @@
763763
int mid, /* Use the version of the file in this check-in */
764764
int webLabel, /* Use web-style annotations if true */
765765
int iLimit, /* Limit the number of levels if greater than zero */
766766
int annFlags /* Flags to alter the annotation */
767767
){
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 */
770770
int rid; /* Artifact ID of the file being annotated */
771771
char *zLabel; /* Label to apply to a line */
772772
Stmt q; /* Query returning all ancestor versions */
773773
774774
/* Initialize the annotation */
@@ -885,11 +885,11 @@
885885
*/
886886
void annotate_cmd(void){
887887
int fnid; /* Filename ID */
888888
int fid; /* File instance ID */
889889
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 */
891891
char *zFilename; /* Cannonical filename */
892892
Annotator ann; /* The annotation of the file */
893893
int i; /* Loop counter */
894894
const char *zLimit; /* The value to the --limit option */
895895
int iLimit; /* How far back in time to look */
896896
--- 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 @@
706706
**
707707
** The root of the tree is defined by the g.zLocalRoot variable.
708708
*/
709709
int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){
710710
int n;
711
- Blob full;
711
+ Blob full = empty_blob;
712712
int nFull;
713713
char *zFull;
714714
715715
blob_zero(pOut);
716716
db_must_be_within_tree();
717717
--- 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

Keyboard Shortcuts

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