Fossil SCM

Minor optimization: replace calls to mprintf("%s", X) with fossil_strdup(X).

danield 2025-07-23 15:58 trunk
Commit 4c3e1728e1b1a9cb8425046aad3f5c753f33abd751a8a365420cf3397ba21ab9
+1 -1
--- src/bisect.c
+++ src/bisect.c
@@ -336,11 +336,11 @@
336336
}
337337
zUuid = db_text(0,"SELECT lower(uuid) FROM blob WHERE rid=%d", rid);
338338
if( blob_size(&link)>0 ) blob_append(&link, "-", 1);
339339
blob_appendf(&link, "%c%.10s", cPrefix, zUuid);
340340
}
341
- zResult = mprintf("%s", blob_str(&link));
341
+ zResult = fossil_strdup(blob_str(&link));
342342
blob_reset(&link);
343343
blob_reset(&log);
344344
blob_reset(&id);
345345
return zResult;
346346
}
347347
--- src/bisect.c
+++ src/bisect.c
@@ -336,11 +336,11 @@
336 }
337 zUuid = db_text(0,"SELECT lower(uuid) FROM blob WHERE rid=%d", rid);
338 if( blob_size(&link)>0 ) blob_append(&link, "-", 1);
339 blob_appendf(&link, "%c%.10s", cPrefix, zUuid);
340 }
341 zResult = mprintf("%s", blob_str(&link));
342 blob_reset(&link);
343 blob_reset(&log);
344 blob_reset(&id);
345 return zResult;
346 }
347
--- src/bisect.c
+++ src/bisect.c
@@ -336,11 +336,11 @@
336 }
337 zUuid = db_text(0,"SELECT lower(uuid) FROM blob WHERE rid=%d", rid);
338 if( blob_size(&link)>0 ) blob_append(&link, "-", 1);
339 blob_appendf(&link, "%c%.10s", cPrefix, zUuid);
340 }
341 zResult = fossil_strdup(blob_str(&link));
342 blob_reset(&link);
343 blob_reset(&log);
344 blob_reset(&id);
345 return zResult;
346 }
347
+1 -1
--- src/chat.c
+++ src/chat.c
@@ -1321,11 +1321,11 @@
13211321
if( zMsg && zMsg[0] ){
13221322
blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"msg\"\r\n"
13231323
"\r\n%s\r\n%s", zMsg, zBoundary);
13241324
}
13251325
if( zFilename && blob_read_from_file(&fcontent, zFilename, ExtFILE)>0 ){
1326
- char *zFN = mprintf("%s", file_tail(zAs ? zAs : zFilename));
1326
+ char *zFN = fossil_strdup(file_tail(zAs ? zAs : zFilename));
13271327
int i;
13281328
const char *zMime = mimetype_from_name(zFN);
13291329
for(i=0; zFN[i]; i++){
13301330
char c = zFN[i];
13311331
if( fossil_isalnum(c) ) continue;
13321332
--- src/chat.c
+++ src/chat.c
@@ -1321,11 +1321,11 @@
1321 if( zMsg && zMsg[0] ){
1322 blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"msg\"\r\n"
1323 "\r\n%s\r\n%s", zMsg, zBoundary);
1324 }
1325 if( zFilename && blob_read_from_file(&fcontent, zFilename, ExtFILE)>0 ){
1326 char *zFN = mprintf("%s", file_tail(zAs ? zAs : zFilename));
1327 int i;
1328 const char *zMime = mimetype_from_name(zFN);
1329 for(i=0; zFN[i]; i++){
1330 char c = zFN[i];
1331 if( fossil_isalnum(c) ) continue;
1332
--- src/chat.c
+++ src/chat.c
@@ -1321,11 +1321,11 @@
1321 if( zMsg && zMsg[0] ){
1322 blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"msg\"\r\n"
1323 "\r\n%s\r\n%s", zMsg, zBoundary);
1324 }
1325 if( zFilename && blob_read_from_file(&fcontent, zFilename, ExtFILE)>0 ){
1326 char *zFN = fossil_strdup(file_tail(zAs ? zAs : zFilename));
1327 int i;
1328 const char *zMime = mimetype_from_name(zFN);
1329 for(i=0; zFN[i]; i++){
1330 char c = zFN[i];
1331 if( fossil_isalnum(c) ) continue;
1332
+1 -1
--- src/checkin.c
+++ src/checkin.c
@@ -1386,11 +1386,11 @@
13861386
file_relative_name(g.zLocalRoot, &fname, 1);
13871387
zFile = db_text(0, "SELECT '%qci-comment-'||hex(randomblob(6))||'.txt'",
13881388
blob_str(&fname));
13891389
}else{
13901390
file_tempname(&fname, "ci-comment",0);
1391
- zFile = mprintf("%s", blob_str(&fname));
1391
+ zFile = fossil_strdup(blob_str(&fname));
13921392
}
13931393
blob_reset(&fname);
13941394
}
13951395
#if defined(_WIN32)
13961396
blob_add_cr(pPrompt);
13971397
--- src/checkin.c
+++ src/checkin.c
@@ -1386,11 +1386,11 @@
1386 file_relative_name(g.zLocalRoot, &fname, 1);
1387 zFile = db_text(0, "SELECT '%qci-comment-'||hex(randomblob(6))||'.txt'",
1388 blob_str(&fname));
1389 }else{
1390 file_tempname(&fname, "ci-comment",0);
1391 zFile = mprintf("%s", blob_str(&fname));
1392 }
1393 blob_reset(&fname);
1394 }
1395 #if defined(_WIN32)
1396 blob_add_cr(pPrompt);
1397
--- src/checkin.c
+++ src/checkin.c
@@ -1386,11 +1386,11 @@
1386 file_relative_name(g.zLocalRoot, &fname, 1);
1387 zFile = db_text(0, "SELECT '%qci-comment-'||hex(randomblob(6))||'.txt'",
1388 blob_str(&fname));
1389 }else{
1390 file_tempname(&fname, "ci-comment",0);
1391 zFile = fossil_strdup(blob_str(&fname));
1392 }
1393 blob_reset(&fname);
1394 }
1395 #if defined(_WIN32)
1396 blob_add_cr(pPrompt);
1397
+2 -2
--- src/clone.c
+++ src/clone.c
@@ -348,11 +348,11 @@
348348
const char *zHttpAuth, /* Credentials in the form "user:password" */
349349
int fRemember, /* True to remember credentials for later reuse */
350350
const char *zUrl /* URL for which these credentials apply */
351351
){
352352
if( zHttpAuth && zHttpAuth[0] ){
353
- g.zHttpAuth = mprintf("%s", zHttpAuth);
353
+ g.zHttpAuth = fossil_strdup(zHttpAuth);
354354
}
355355
if( fRemember ){
356356
if( g.zHttpAuth && g.zHttpAuth[0] ){
357357
set_httpauth(g.zHttpAuth);
358358
}else if( zUrl && zUrl[0] ){
@@ -388,11 +388,11 @@
388388
void clone_ssh_find_options(void){
389389
const char *zSshCmd; /* SSH command string */
390390
391391
zSshCmd = find_option("ssh-command","c",1);
392392
if( zSshCmd && zSshCmd[0] ){
393
- g.zSshCmd = mprintf("%s", zSshCmd);
393
+ g.zSshCmd = fossil_strdup(zSshCmd);
394394
}
395395
}
396396
397397
/*
398398
** Set SSH options discovered in global variables (set from command line
399399
--- src/clone.c
+++ src/clone.c
@@ -348,11 +348,11 @@
348 const char *zHttpAuth, /* Credentials in the form "user:password" */
349 int fRemember, /* True to remember credentials for later reuse */
350 const char *zUrl /* URL for which these credentials apply */
351 ){
352 if( zHttpAuth && zHttpAuth[0] ){
353 g.zHttpAuth = mprintf("%s", zHttpAuth);
354 }
355 if( fRemember ){
356 if( g.zHttpAuth && g.zHttpAuth[0] ){
357 set_httpauth(g.zHttpAuth);
358 }else if( zUrl && zUrl[0] ){
@@ -388,11 +388,11 @@
388 void clone_ssh_find_options(void){
389 const char *zSshCmd; /* SSH command string */
390
391 zSshCmd = find_option("ssh-command","c",1);
392 if( zSshCmd && zSshCmd[0] ){
393 g.zSshCmd = mprintf("%s", zSshCmd);
394 }
395 }
396
397 /*
398 ** Set SSH options discovered in global variables (set from command line
399
--- src/clone.c
+++ src/clone.c
@@ -348,11 +348,11 @@
348 const char *zHttpAuth, /* Credentials in the form "user:password" */
349 int fRemember, /* True to remember credentials for later reuse */
350 const char *zUrl /* URL for which these credentials apply */
351 ){
352 if( zHttpAuth && zHttpAuth[0] ){
353 g.zHttpAuth = fossil_strdup(zHttpAuth);
354 }
355 if( fRemember ){
356 if( g.zHttpAuth && g.zHttpAuth[0] ){
357 set_httpauth(g.zHttpAuth);
358 }else if( zUrl && zUrl[0] ){
@@ -388,11 +388,11 @@
388 void clone_ssh_find_options(void){
389 const char *zSshCmd; /* SSH command string */
390
391 zSshCmd = find_option("ssh-command","c",1);
392 if( zSshCmd && zSshCmd[0] ){
393 g.zSshCmd = fossil_strdup(zSshCmd);
394 }
395 }
396
397 /*
398 ** Set SSH options discovered in global variables (set from command line
399
+2 -2
--- src/comformat.c
+++ src/comformat.c
@@ -807,17 +807,17 @@
807807
verify_all_options();
808808
zPrefix = zText = zOrigText = 0;
809809
if( fromFile ){
810810
Blob fileData;
811811
blob_read_from_file(&fileData, fromFile, ExtFILE);
812
- zText = mprintf("%s", blob_str(&fileData));
812
+ zText = fossil_strdup(blob_str(&fileData));
813813
blob_reset(&fileData);
814814
}
815815
if( fromOrig ){
816816
Blob fileData;
817817
blob_read_from_file(&fileData, fromOrig, ExtFILE);
818
- zOrigText = mprintf("%s", blob_str(&fileData));
818
+ zOrigText = fossil_strdup(blob_str(&fileData));
819819
blob_reset(&fileData);
820820
}
821821
for(i=2; i<g.argc; i++){
822822
if( zText==0 ){
823823
zText = g.argv[i];
824824
--- src/comformat.c
+++ src/comformat.c
@@ -807,17 +807,17 @@
807 verify_all_options();
808 zPrefix = zText = zOrigText = 0;
809 if( fromFile ){
810 Blob fileData;
811 blob_read_from_file(&fileData, fromFile, ExtFILE);
812 zText = mprintf("%s", blob_str(&fileData));
813 blob_reset(&fileData);
814 }
815 if( fromOrig ){
816 Blob fileData;
817 blob_read_from_file(&fileData, fromOrig, ExtFILE);
818 zOrigText = mprintf("%s", blob_str(&fileData));
819 blob_reset(&fileData);
820 }
821 for(i=2; i<g.argc; i++){
822 if( zText==0 ){
823 zText = g.argv[i];
824
--- src/comformat.c
+++ src/comformat.c
@@ -807,17 +807,17 @@
807 verify_all_options();
808 zPrefix = zText = zOrigText = 0;
809 if( fromFile ){
810 Blob fileData;
811 blob_read_from_file(&fileData, fromFile, ExtFILE);
812 zText = fossil_strdup(blob_str(&fileData));
813 blob_reset(&fileData);
814 }
815 if( fromOrig ){
816 Blob fileData;
817 blob_read_from_file(&fileData, fromOrig, ExtFILE);
818 zOrigText = fossil_strdup(blob_str(&fileData));
819 blob_reset(&fileData);
820 }
821 for(i=2; i<g.argc; i++){
822 if( zText==0 ){
823 zText = g.argv[i];
824
+1 -1
--- src/cookies.c
+++ src/cookies.c
@@ -86,11 +86,11 @@
8686
void cookie_parse(void){
8787
char *z;
8888
if( cookies.bIsInit ) return;
8989
z = (char*)P(DISPLAY_SETTINGS_COOKIE);
9090
if( z==0 ) z = "";
91
- cookies.zCookieValue = z = mprintf("%s", z);
91
+ cookies.zCookieValue = z = fossil_strdup(z);
9292
cookies.bIsInit = 1;
9393
while( cookies.nParam<COOKIE_NPARAM ){
9494
while( fossil_isspace(z[0]) ) z++;
9595
if( z[0]==0 ) break;
9696
cookies.aParam[cookies.nParam].zPName = z;
9797
--- src/cookies.c
+++ src/cookies.c
@@ -86,11 +86,11 @@
86 void cookie_parse(void){
87 char *z;
88 if( cookies.bIsInit ) return;
89 z = (char*)P(DISPLAY_SETTINGS_COOKIE);
90 if( z==0 ) z = "";
91 cookies.zCookieValue = z = mprintf("%s", z);
92 cookies.bIsInit = 1;
93 while( cookies.nParam<COOKIE_NPARAM ){
94 while( fossil_isspace(z[0]) ) z++;
95 if( z[0]==0 ) break;
96 cookies.aParam[cookies.nParam].zPName = z;
97
--- src/cookies.c
+++ src/cookies.c
@@ -86,11 +86,11 @@
86 void cookie_parse(void){
87 char *z;
88 if( cookies.bIsInit ) return;
89 z = (char*)P(DISPLAY_SETTINGS_COOKIE);
90 if( z==0 ) z = "";
91 cookies.zCookieValue = z = fossil_strdup(z);
92 cookies.bIsInit = 1;
93 while( cookies.nParam<COOKIE_NPARAM ){
94 while( fossil_isspace(z[0]) ) z++;
95 if( z[0]==0 ) break;
96 cookies.aParam[cookies.nParam].zPName = z;
97
+1 -1
--- src/event.c
+++ src/event.c
@@ -382,11 +382,11 @@
382382
const char *zClr; /* Name of the background color */
383383
const char *zMimetype = P("mimetype"); /* Mimetype of zBody */
384384
int isNew = 0;
385385
386386
if( zBody ){
387
- zBody = mprintf("%s", zBody);
387
+ zBody = fossil_strdup(zBody);
388388
}
389389
login_check_credentials();
390390
zId = P("name");
391391
if( zId==0 ){
392392
zId = db_text(0, "SELECT lower(hex(randomblob(20)))");
393393
--- src/event.c
+++ src/event.c
@@ -382,11 +382,11 @@
382 const char *zClr; /* Name of the background color */
383 const char *zMimetype = P("mimetype"); /* Mimetype of zBody */
384 int isNew = 0;
385
386 if( zBody ){
387 zBody = mprintf("%s", zBody);
388 }
389 login_check_credentials();
390 zId = P("name");
391 if( zId==0 ){
392 zId = db_text(0, "SELECT lower(hex(randomblob(20)))");
393
--- src/event.c
+++ src/event.c
@@ -382,11 +382,11 @@
382 const char *zClr; /* Name of the background color */
383 const char *zMimetype = P("mimetype"); /* Mimetype of zBody */
384 int isNew = 0;
385
386 if( zBody ){
387 zBody = fossil_strdup(zBody);
388 }
389 login_check_credentials();
390 zId = P("name");
391 if( zId==0 ){
392 zId = db_text(0, "SELECT lower(hex(randomblob(20)))");
393
+5 -5
--- src/export.c
+++ src/export.c
@@ -58,11 +58,11 @@
5858
}
5959
db_static_prepare(&q, "SELECT info FROM user WHERE login=:user");
6060
db_bind_text(&q, ":user", zUser);
6161
if( db_step(&q)!=SQLITE_ROW ){
6262
db_reset(&q);
63
- zName = mprintf("%s", zUser);
63
+ zName = fossil_strdup(zUser);
6464
for(i=j=0; zName[i]; i++){
6565
if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){
6666
zName[j++] = zName[i];
6767
}
6868
}
@@ -102,11 +102,11 @@
102102
atEmailFirst = i+1;
103103
}
104104
}
105105
if( zContact[i]==0 ){
106106
/* No email address found. Take as user info if not empty */
107
- zName = mprintf("%s", zContact[0] ? zContact : zUser);
107
+ zName = fossil_strdup(zContact[0] ? zContact : zUser);
108108
for(i=j=0; zName[i]; i++){
109109
if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){
110110
zName[j++] = zName[i];
111111
}
112112
}
@@ -149,11 +149,11 @@
149149
for(j=0; j<i && zContact[j] && zContact[j]==' '; j++){}
150150
zName = mprintf("%.*s", i-j+1, &zContact[j]);
151151
}
152152
}
153153
154
- if( zName==NULL ) zName = mprintf("%s", zUser);
154
+ if( zName==NULL ) zName = fossil_strdup(zUser);
155155
for(i=j=0; zName[i]; i++){
156156
if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){
157157
zName[j++] = zName[i];
158158
}
159159
}
@@ -172,11 +172,11 @@
172172
** https://git-scm.com/docs/git-check-ref-format
173173
** This implementation assumes we are only printing
174174
** the branch or tag part of the reference.
175175
*/
176176
static void print_ref(const char *zRef){
177
- char *zEncoded = mprintf("%s", zRef);
177
+ char *zEncoded = fossil_strdup(zRef);
178178
int i, w;
179179
if (zEncoded[0]=='@' && zEncoded[1]=='\0'){
180180
putchar(REFREPLACEMENT);
181181
return;
182182
}
@@ -1152,11 +1152,11 @@
11521152
TAG_BRANCH, rid
11531153
);
11541154
if( fossil_strcmp(zBranch,"trunk")==0 ){
11551155
assert( gitmirror_mainbranch!=0 );
11561156
fossil_free(zBranch);
1157
- zBranch = mprintf("%s",gitmirror_mainbranch);
1157
+ zBranch = fossil_strdup(gitmirror_mainbranch);
11581158
}else if( zBranch==0 ){
11591159
zBranch = mprintf("unknown");
11601160
}else{
11611161
gitmirror_sanitize_name(zBranch);
11621162
}
11631163
--- src/export.c
+++ src/export.c
@@ -58,11 +58,11 @@
58 }
59 db_static_prepare(&q, "SELECT info FROM user WHERE login=:user");
60 db_bind_text(&q, ":user", zUser);
61 if( db_step(&q)!=SQLITE_ROW ){
62 db_reset(&q);
63 zName = mprintf("%s", zUser);
64 for(i=j=0; zName[i]; i++){
65 if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){
66 zName[j++] = zName[i];
67 }
68 }
@@ -102,11 +102,11 @@
102 atEmailFirst = i+1;
103 }
104 }
105 if( zContact[i]==0 ){
106 /* No email address found. Take as user info if not empty */
107 zName = mprintf("%s", zContact[0] ? zContact : zUser);
108 for(i=j=0; zName[i]; i++){
109 if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){
110 zName[j++] = zName[i];
111 }
112 }
@@ -149,11 +149,11 @@
149 for(j=0; j<i && zContact[j] && zContact[j]==' '; j++){}
150 zName = mprintf("%.*s", i-j+1, &zContact[j]);
151 }
152 }
153
154 if( zName==NULL ) zName = mprintf("%s", zUser);
155 for(i=j=0; zName[i]; i++){
156 if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){
157 zName[j++] = zName[i];
158 }
159 }
@@ -172,11 +172,11 @@
172 ** https://git-scm.com/docs/git-check-ref-format
173 ** This implementation assumes we are only printing
174 ** the branch or tag part of the reference.
175 */
176 static void print_ref(const char *zRef){
177 char *zEncoded = mprintf("%s", zRef);
178 int i, w;
179 if (zEncoded[0]=='@' && zEncoded[1]=='\0'){
180 putchar(REFREPLACEMENT);
181 return;
182 }
@@ -1152,11 +1152,11 @@
1152 TAG_BRANCH, rid
1153 );
1154 if( fossil_strcmp(zBranch,"trunk")==0 ){
1155 assert( gitmirror_mainbranch!=0 );
1156 fossil_free(zBranch);
1157 zBranch = mprintf("%s",gitmirror_mainbranch);
1158 }else if( zBranch==0 ){
1159 zBranch = mprintf("unknown");
1160 }else{
1161 gitmirror_sanitize_name(zBranch);
1162 }
1163
--- src/export.c
+++ src/export.c
@@ -58,11 +58,11 @@
58 }
59 db_static_prepare(&q, "SELECT info FROM user WHERE login=:user");
60 db_bind_text(&q, ":user", zUser);
61 if( db_step(&q)!=SQLITE_ROW ){
62 db_reset(&q);
63 zName = fossil_strdup(zUser);
64 for(i=j=0; zName[i]; i++){
65 if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){
66 zName[j++] = zName[i];
67 }
68 }
@@ -102,11 +102,11 @@
102 atEmailFirst = i+1;
103 }
104 }
105 if( zContact[i]==0 ){
106 /* No email address found. Take as user info if not empty */
107 zName = fossil_strdup(zContact[0] ? zContact : zUser);
108 for(i=j=0; zName[i]; i++){
109 if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){
110 zName[j++] = zName[i];
111 }
112 }
@@ -149,11 +149,11 @@
149 for(j=0; j<i && zContact[j] && zContact[j]==' '; j++){}
150 zName = mprintf("%.*s", i-j+1, &zContact[j]);
151 }
152 }
153
154 if( zName==NULL ) zName = fossil_strdup(zUser);
155 for(i=j=0; zName[i]; i++){
156 if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){
157 zName[j++] = zName[i];
158 }
159 }
@@ -172,11 +172,11 @@
172 ** https://git-scm.com/docs/git-check-ref-format
173 ** This implementation assumes we are only printing
174 ** the branch or tag part of the reference.
175 */
176 static void print_ref(const char *zRef){
177 char *zEncoded = fossil_strdup(zRef);
178 int i, w;
179 if (zEncoded[0]=='@' && zEncoded[1]=='\0'){
180 putchar(REFREPLACEMENT);
181 return;
182 }
@@ -1152,11 +1152,11 @@
1152 TAG_BRANCH, rid
1153 );
1154 if( fossil_strcmp(zBranch,"trunk")==0 ){
1155 assert( gitmirror_mainbranch!=0 );
1156 fossil_free(zBranch);
1157 zBranch = fossil_strdup(gitmirror_mainbranch);
1158 }else if( zBranch==0 ){
1159 zBranch = mprintf("unknown");
1160 }else{
1161 gitmirror_sanitize_name(zBranch);
1162 }
1163
+5 -5
--- src/file.c
+++ src/file.c
@@ -260,11 +260,11 @@
260260
int i, nName;
261261
char *zName, zBuf[1000];
262262
263263
nName = strlen(zLinkFile);
264264
if( nName>=(int)sizeof(zBuf) ){
265
- zName = mprintf("%s", zLinkFile);
265
+ zName = fossil_strdup(zLinkFile);
266266
}else{
267267
zName = zBuf;
268268
memcpy(zName, zLinkFile, nName+1);
269269
}
270270
nName = file_simplify_name(zName, nName, 0);
@@ -425,11 +425,11 @@
425425
*/
426426
int file_isdir(const char *zFilename, int eFType){
427427
int rc;
428428
char *zFN;
429429
430
- zFN = mprintf("%s", zFilename);
430
+ zFN = fossil_strdup(zFilename);
431431
file_simplify_name(zFN, -1, 0);
432432
rc = getStat(zFN, eFType);
433433
if( rc ){
434434
rc = 0; /* It does not exist at all. */
435435
}else if( S_ISDIR(fx.fileStat.st_mode) ){
@@ -904,11 +904,11 @@
904904
){
905905
int nName, rc = 0;
906906
char *zName;
907907
908908
nName = strlen(zFilename);
909
- zName = mprintf("%s", zFilename);
909
+ zName = fossil_strdup(zFilename);
910910
nName = file_simplify_name(zName, nName, 0);
911911
while( nName>0 && zName[nName-1]!='/' ){ nName--; }
912912
if( nName>1 ){
913913
zName[nName-1] = 0;
914914
if( file_isdir(zName, eFType)!=1 ){
@@ -1277,13 +1277,13 @@
12771277
const char *zTail;
12781278
for(i=2; i<g.argc; i++){
12791279
zTail = file_skip_userhost(g.argv[i]);
12801280
if( zTail ){
12811281
fossil_print("... ON REMOTE: %.*s\n", (int)(zTail-g.argv[i]), g.argv[i]);
1282
- z = mprintf("%s", zTail);
1282
+ z = fossil_strdup(zTail);
12831283
}else{
1284
- z = mprintf("%s", g.argv[i]);
1284
+ z = fossil_strdup(g.argv[i]);
12851285
}
12861286
fossil_print("[%s] -> ", z);
12871287
file_simplify_name(z, -1, 0);
12881288
fossil_print("[%s]\n", z);
12891289
fossil_free(z);
12901290
--- src/file.c
+++ src/file.c
@@ -260,11 +260,11 @@
260 int i, nName;
261 char *zName, zBuf[1000];
262
263 nName = strlen(zLinkFile);
264 if( nName>=(int)sizeof(zBuf) ){
265 zName = mprintf("%s", zLinkFile);
266 }else{
267 zName = zBuf;
268 memcpy(zName, zLinkFile, nName+1);
269 }
270 nName = file_simplify_name(zName, nName, 0);
@@ -425,11 +425,11 @@
425 */
426 int file_isdir(const char *zFilename, int eFType){
427 int rc;
428 char *zFN;
429
430 zFN = mprintf("%s", zFilename);
431 file_simplify_name(zFN, -1, 0);
432 rc = getStat(zFN, eFType);
433 if( rc ){
434 rc = 0; /* It does not exist at all. */
435 }else if( S_ISDIR(fx.fileStat.st_mode) ){
@@ -904,11 +904,11 @@
904 ){
905 int nName, rc = 0;
906 char *zName;
907
908 nName = strlen(zFilename);
909 zName = mprintf("%s", zFilename);
910 nName = file_simplify_name(zName, nName, 0);
911 while( nName>0 && zName[nName-1]!='/' ){ nName--; }
912 if( nName>1 ){
913 zName[nName-1] = 0;
914 if( file_isdir(zName, eFType)!=1 ){
@@ -1277,13 +1277,13 @@
1277 const char *zTail;
1278 for(i=2; i<g.argc; i++){
1279 zTail = file_skip_userhost(g.argv[i]);
1280 if( zTail ){
1281 fossil_print("... ON REMOTE: %.*s\n", (int)(zTail-g.argv[i]), g.argv[i]);
1282 z = mprintf("%s", zTail);
1283 }else{
1284 z = mprintf("%s", g.argv[i]);
1285 }
1286 fossil_print("[%s] -> ", z);
1287 file_simplify_name(z, -1, 0);
1288 fossil_print("[%s]\n", z);
1289 fossil_free(z);
1290
--- src/file.c
+++ src/file.c
@@ -260,11 +260,11 @@
260 int i, nName;
261 char *zName, zBuf[1000];
262
263 nName = strlen(zLinkFile);
264 if( nName>=(int)sizeof(zBuf) ){
265 zName = fossil_strdup(zLinkFile);
266 }else{
267 zName = zBuf;
268 memcpy(zName, zLinkFile, nName+1);
269 }
270 nName = file_simplify_name(zName, nName, 0);
@@ -425,11 +425,11 @@
425 */
426 int file_isdir(const char *zFilename, int eFType){
427 int rc;
428 char *zFN;
429
430 zFN = fossil_strdup(zFilename);
431 file_simplify_name(zFN, -1, 0);
432 rc = getStat(zFN, eFType);
433 if( rc ){
434 rc = 0; /* It does not exist at all. */
435 }else if( S_ISDIR(fx.fileStat.st_mode) ){
@@ -904,11 +904,11 @@
904 ){
905 int nName, rc = 0;
906 char *zName;
907
908 nName = strlen(zFilename);
909 zName = fossil_strdup(zFilename);
910 nName = file_simplify_name(zName, nName, 0);
911 while( nName>0 && zName[nName-1]!='/' ){ nName--; }
912 if( nName>1 ){
913 zName[nName-1] = 0;
914 if( file_isdir(zName, eFType)!=1 ){
@@ -1277,13 +1277,13 @@
1277 const char *zTail;
1278 for(i=2; i<g.argc; i++){
1279 zTail = file_skip_userhost(g.argv[i]);
1280 if( zTail ){
1281 fossil_print("... ON REMOTE: %.*s\n", (int)(zTail-g.argv[i]), g.argv[i]);
1282 z = fossil_strdup(zTail);
1283 }else{
1284 z = fossil_strdup(g.argv[i]);
1285 }
1286 fossil_print("[%s] -> ", z);
1287 file_simplify_name(z, -1, 0);
1288 fossil_print("[%s]\n", z);
1289 fossil_free(z);
1290
+6 -6
--- src/fileedit.c
+++ src/fileedit.c
@@ -825,13 +825,13 @@
825825
}
826826
db_begin_transaction();
827827
zFilename = g.argv[2];
828828
cimi.zFilename = mprintf("%/", zAsFilename ? zAsFilename : zFilename);
829829
cimi.filePerm = file_perm(zFilename, ExtFILE);
830
- cimi.zUser = mprintf("%s", zUser ? zUser : login_name());
830
+ cimi.zUser = fossil_strdup(zUser ? zUser : login_name());
831831
if(zDate){
832
- cimi.zDate = mprintf("%s", zDate);
832
+ cimi.zDate = fossil_strdup(zDate);
833833
}
834834
if(zRevision==0 || zRevision[0]==0){
835835
if(g.localOpen/*check-out*/){
836836
zRevision = db_lget("checkout-hash", 0)/*leak*/;
837837
}else{
@@ -928,11 +928,11 @@
928928
char * zFileUuid = 0;
929929
db_prepare(&stmt, "SELECT uuid, perm FROM files_of_checkin "
930930
"WHERE filename=%Q %s AND checkinID=%d",
931931
zFilename, filename_collation(), vid);
932932
if(SQLITE_ROW==db_step(&stmt)){
933
- zFileUuid = mprintf("%s",db_column_text(&stmt, 0));
933
+ zFileUuid = fossil_strdup(db_column_text(&stmt, 0));
934934
if(pFilePerm){
935935
*pFilePerm = mfile_permstr_int(db_column_text(&stmt, 1));
936936
}
937937
}
938938
db_finalize(&stmt);
@@ -1187,11 +1187,11 @@
11871187
if(bIsMissingArg){
11881188
*bIsMissingArg = 1;
11891189
}
11901190
fail((pErr,"Missing required 'filename' parameter."));
11911191
}
1192
- p->zFilename = mprintf("%s",zFlag);
1192
+ p->zFilename = fossil_strdup(zFlag);
11931193
11941194
if(0==fileedit_is_editable(p->zFilename)){
11951195
rc = 403;
11961196
fail((pErr,"Filename [%h] is disallowed "
11971197
"by the [fileedit-glob] repository "
@@ -1248,11 +1248,11 @@
12481248
if(zFlag!=0 && *zFlag!=0){
12491249
blob_append(&p->comment, zFlag, -1);
12501250
}
12511251
zFlag = P("comment_mimetype");
12521252
if(zFlag){
1253
- p->zCommentMimetype = mprintf("%s",zFlag);
1253
+ p->zCommentMimetype = fossil_strdup(zFlag);
12541254
zFlag = 0;
12551255
}
12561256
#define p_int(K) atoi(PD(K,"0"))
12571257
if(p_int("dry_run")!=0){
12581258
p->flags |= CIMINI_DRY_RUN;
@@ -1284,11 +1284,11 @@
12841284
#undef p_int
12851285
/*
12861286
** TODO?: date-override date selection field. Maybe use
12871287
** an input[type=datetime-local].
12881288
*/
1289
- p->zUser = mprintf("%s",g.zLogin);
1289
+ p->zUser = fossil_strdup(g.zLogin);
12901290
return 0;
12911291
end_fail:
12921292
#undef fail
12931293
fossil_free(zFileUuid);
12941294
return rc ? rc : 500;
12951295
--- src/fileedit.c
+++ src/fileedit.c
@@ -825,13 +825,13 @@
825 }
826 db_begin_transaction();
827 zFilename = g.argv[2];
828 cimi.zFilename = mprintf("%/", zAsFilename ? zAsFilename : zFilename);
829 cimi.filePerm = file_perm(zFilename, ExtFILE);
830 cimi.zUser = mprintf("%s", zUser ? zUser : login_name());
831 if(zDate){
832 cimi.zDate = mprintf("%s", zDate);
833 }
834 if(zRevision==0 || zRevision[0]==0){
835 if(g.localOpen/*check-out*/){
836 zRevision = db_lget("checkout-hash", 0)/*leak*/;
837 }else{
@@ -928,11 +928,11 @@
928 char * zFileUuid = 0;
929 db_prepare(&stmt, "SELECT uuid, perm FROM files_of_checkin "
930 "WHERE filename=%Q %s AND checkinID=%d",
931 zFilename, filename_collation(), vid);
932 if(SQLITE_ROW==db_step(&stmt)){
933 zFileUuid = mprintf("%s",db_column_text(&stmt, 0));
934 if(pFilePerm){
935 *pFilePerm = mfile_permstr_int(db_column_text(&stmt, 1));
936 }
937 }
938 db_finalize(&stmt);
@@ -1187,11 +1187,11 @@
1187 if(bIsMissingArg){
1188 *bIsMissingArg = 1;
1189 }
1190 fail((pErr,"Missing required 'filename' parameter."));
1191 }
1192 p->zFilename = mprintf("%s",zFlag);
1193
1194 if(0==fileedit_is_editable(p->zFilename)){
1195 rc = 403;
1196 fail((pErr,"Filename [%h] is disallowed "
1197 "by the [fileedit-glob] repository "
@@ -1248,11 +1248,11 @@
1248 if(zFlag!=0 && *zFlag!=0){
1249 blob_append(&p->comment, zFlag, -1);
1250 }
1251 zFlag = P("comment_mimetype");
1252 if(zFlag){
1253 p->zCommentMimetype = mprintf("%s",zFlag);
1254 zFlag = 0;
1255 }
1256 #define p_int(K) atoi(PD(K,"0"))
1257 if(p_int("dry_run")!=0){
1258 p->flags |= CIMINI_DRY_RUN;
@@ -1284,11 +1284,11 @@
1284 #undef p_int
1285 /*
1286 ** TODO?: date-override date selection field. Maybe use
1287 ** an input[type=datetime-local].
1288 */
1289 p->zUser = mprintf("%s",g.zLogin);
1290 return 0;
1291 end_fail:
1292 #undef fail
1293 fossil_free(zFileUuid);
1294 return rc ? rc : 500;
1295
--- src/fileedit.c
+++ src/fileedit.c
@@ -825,13 +825,13 @@
825 }
826 db_begin_transaction();
827 zFilename = g.argv[2];
828 cimi.zFilename = mprintf("%/", zAsFilename ? zAsFilename : zFilename);
829 cimi.filePerm = file_perm(zFilename, ExtFILE);
830 cimi.zUser = fossil_strdup(zUser ? zUser : login_name());
831 if(zDate){
832 cimi.zDate = fossil_strdup(zDate);
833 }
834 if(zRevision==0 || zRevision[0]==0){
835 if(g.localOpen/*check-out*/){
836 zRevision = db_lget("checkout-hash", 0)/*leak*/;
837 }else{
@@ -928,11 +928,11 @@
928 char * zFileUuid = 0;
929 db_prepare(&stmt, "SELECT uuid, perm FROM files_of_checkin "
930 "WHERE filename=%Q %s AND checkinID=%d",
931 zFilename, filename_collation(), vid);
932 if(SQLITE_ROW==db_step(&stmt)){
933 zFileUuid = fossil_strdup(db_column_text(&stmt, 0));
934 if(pFilePerm){
935 *pFilePerm = mfile_permstr_int(db_column_text(&stmt, 1));
936 }
937 }
938 db_finalize(&stmt);
@@ -1187,11 +1187,11 @@
1187 if(bIsMissingArg){
1188 *bIsMissingArg = 1;
1189 }
1190 fail((pErr,"Missing required 'filename' parameter."));
1191 }
1192 p->zFilename = fossil_strdup(zFlag);
1193
1194 if(0==fileedit_is_editable(p->zFilename)){
1195 rc = 403;
1196 fail((pErr,"Filename [%h] is disallowed "
1197 "by the [fileedit-glob] repository "
@@ -1248,11 +1248,11 @@
1248 if(zFlag!=0 && *zFlag!=0){
1249 blob_append(&p->comment, zFlag, -1);
1250 }
1251 zFlag = P("comment_mimetype");
1252 if(zFlag){
1253 p->zCommentMimetype = fossil_strdup(zFlag);
1254 zFlag = 0;
1255 }
1256 #define p_int(K) atoi(PD(K,"0"))
1257 if(p_int("dry_run")!=0){
1258 p->flags |= CIMINI_DRY_RUN;
@@ -1284,11 +1284,11 @@
1284 #undef p_int
1285 /*
1286 ** TODO?: date-override date selection field. Maybe use
1287 ** an input[type=datetime-local].
1288 */
1289 p->zUser = fossil_strdup(g.zLogin);
1290 return 0;
1291 end_fail:
1292 #undef fail
1293 fossil_free(zFileUuid);
1294 return rc ? rc : 500;
1295
+1 -1
--- src/graph.c
+++ src/graph.c
@@ -226,11 +226,11 @@
226226
for(i=0; i<p->nBranch; i++){
227227
if( fossil_strcmp(zBranch, p->azBranch[i])==0 ) return p->azBranch[i];
228228
}
229229
p->nBranch++;
230230
p->azBranch = fossil_realloc(p->azBranch, sizeof(char*)*p->nBranch);
231
- p->azBranch[p->nBranch-1] = mprintf("%s", zBranch);
231
+ p->azBranch[p->nBranch-1] = fossil_strdup(zBranch);
232232
return p->azBranch[p->nBranch-1];
233233
}
234234
235235
/*
236236
** Add a new row to the graph context. Rows are added from top to bottom.
237237
--- src/graph.c
+++ src/graph.c
@@ -226,11 +226,11 @@
226 for(i=0; i<p->nBranch; i++){
227 if( fossil_strcmp(zBranch, p->azBranch[i])==0 ) return p->azBranch[i];
228 }
229 p->nBranch++;
230 p->azBranch = fossil_realloc(p->azBranch, sizeof(char*)*p->nBranch);
231 p->azBranch[p->nBranch-1] = mprintf("%s", zBranch);
232 return p->azBranch[p->nBranch-1];
233 }
234
235 /*
236 ** Add a new row to the graph context. Rows are added from top to bottom.
237
--- src/graph.c
+++ src/graph.c
@@ -226,11 +226,11 @@
226 for(i=0; i<p->nBranch; i++){
227 if( fossil_strcmp(zBranch, p->azBranch[i])==0 ) return p->azBranch[i];
228 }
229 p->nBranch++;
230 p->azBranch = fossil_realloc(p->azBranch, sizeof(char*)*p->nBranch);
231 p->azBranch[p->nBranch-1] = fossil_strdup(zBranch);
232 return p->azBranch[p->nBranch-1];
233 }
234
235 /*
236 ** Add a new row to the graph context. Rows are added from top to bottom.
237
--- src/http_socket.c
+++ src/http_socket.c
@@ -175,11 +175,11 @@
175175
0, 0, NI_NUMERICHOST);
176176
if( rc ){
177177
socket_set_errmsg("getnameinfo() failed: %s", gai_strerror(rc));
178178
goto end_socket_open;
179179
}
180
- g.zIpAddr = mprintf("%s", zRemote);
180
+ g.zIpAddr = fossil_strdup(zRemote);
181181
break;
182182
}
183183
if( p==0 ){
184184
socket_set_errmsg("cannot connect to host %s:%d", pUrlData->name,
185185
pUrlData->port);
186186
--- src/http_socket.c
+++ src/http_socket.c
@@ -175,11 +175,11 @@
175 0, 0, NI_NUMERICHOST);
176 if( rc ){
177 socket_set_errmsg("getnameinfo() failed: %s", gai_strerror(rc));
178 goto end_socket_open;
179 }
180 g.zIpAddr = mprintf("%s", zRemote);
181 break;
182 }
183 if( p==0 ){
184 socket_set_errmsg("cannot connect to host %s:%d", pUrlData->name,
185 pUrlData->port);
186
--- src/http_socket.c
+++ src/http_socket.c
@@ -175,11 +175,11 @@
175 0, 0, NI_NUMERICHOST);
176 if( rc ){
177 socket_set_errmsg("getnameinfo() failed: %s", gai_strerror(rc));
178 goto end_socket_open;
179 }
180 g.zIpAddr = fossil_strdup(zRemote);
181 break;
182 }
183 if( p==0 ){
184 socket_set_errmsg("cannot connect to host %s:%d", pUrlData->name,
185 pUrlData->port);
186
+1 -1
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -638,11 +638,11 @@
638638
** check here for the correct LIBRESSL_VERSION_NUMBER too. For now: disable
639639
*/
640640
#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L \
641641
&& !defined(LIBRESSL_VERSION_NUMBER)
642642
char *ip = BIO_ADDR_hostname_string(BIO_get_conn_address(iBio),1);
643
- g.zIpAddr = mprintf("%s", ip);
643
+ g.zIpAddr = fossil_strdup(ip);
644644
OPENSSL_free(ip);
645645
#else
646646
/* IPv4 only code */
647647
const unsigned char *ip;
648648
ip = (const unsigned char*)BIO_ptr_ctrl(iBio,BIO_C_GET_CONNECT,2);
649649
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -638,11 +638,11 @@
638 ** check here for the correct LIBRESSL_VERSION_NUMBER too. For now: disable
639 */
640 #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L \
641 && !defined(LIBRESSL_VERSION_NUMBER)
642 char *ip = BIO_ADDR_hostname_string(BIO_get_conn_address(iBio),1);
643 g.zIpAddr = mprintf("%s", ip);
644 OPENSSL_free(ip);
645 #else
646 /* IPv4 only code */
647 const unsigned char *ip;
648 ip = (const unsigned char*)BIO_ptr_ctrl(iBio,BIO_C_GET_CONNECT,2);
649
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -638,11 +638,11 @@
638 ** check here for the correct LIBRESSL_VERSION_NUMBER too. For now: disable
639 */
640 #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L \
641 && !defined(LIBRESSL_VERSION_NUMBER)
642 char *ip = BIO_ADDR_hostname_string(BIO_get_conn_address(iBio),1);
643 g.zIpAddr = fossil_strdup(ip);
644 OPENSSL_free(ip);
645 #else
646 /* IPv4 only code */
647 const unsigned char *ip;
648 ip = (const unsigned char*)BIO_ptr_ctrl(iBio,BIO_C_GET_CONNECT,2);
649
--- src/http_transport.c
+++ src/http_transport.c
@@ -121,11 +121,11 @@
121121
*/
122122
Blob zCmd; /* The SSH command */
123123
char *zHost; /* The host name to contact */
124124
125125
fossil_free(g.zIpAddr);
126
- g.zIpAddr = mprintf("%s", pUrlData->name);
126
+ g.zIpAddr = fossil_strdup(pUrlData->name);
127127
transport_ssh_command(&zCmd);
128128
if( pUrlData->port!=pUrlData->dfltPort && pUrlData->port ){
129129
blob_appendf(&zCmd, " -p %d", pUrlData->port);
130130
}
131131
blob_appendf(&zCmd, " -T --"); /* End of switches */
132132
--- src/http_transport.c
+++ src/http_transport.c
@@ -121,11 +121,11 @@
121 */
122 Blob zCmd; /* The SSH command */
123 char *zHost; /* The host name to contact */
124
125 fossil_free(g.zIpAddr);
126 g.zIpAddr = mprintf("%s", pUrlData->name);
127 transport_ssh_command(&zCmd);
128 if( pUrlData->port!=pUrlData->dfltPort && pUrlData->port ){
129 blob_appendf(&zCmd, " -p %d", pUrlData->port);
130 }
131 blob_appendf(&zCmd, " -T --"); /* End of switches */
132
--- src/http_transport.c
+++ src/http_transport.c
@@ -121,11 +121,11 @@
121 */
122 Blob zCmd; /* The SSH command */
123 char *zHost; /* The host name to contact */
124
125 fossil_free(g.zIpAddr);
126 g.zIpAddr = fossil_strdup(pUrlData->name);
127 transport_ssh_command(&zCmd);
128 if( pUrlData->port!=pUrlData->dfltPort && pUrlData->port ){
129 blob_appendf(&zCmd, " -p %d", pUrlData->port);
130 }
131 blob_appendf(&zCmd, " -T --"); /* End of switches */
132
+3 -3
--- src/import.c
+++ src/import.c
@@ -895,11 +895,11 @@
895895
char *sep;
896896
if( zLine[0]=='\n' ) break;
897897
rec->nHeaders += 1;
898898
rec->aHeaders = fossil_realloc(rec->aHeaders,
899899
sizeof(rec->aHeaders[0])*rec->nHeaders);
900
- rec->aHeaders[rec->nHeaders-1].zKey = mprintf("%s", zLine);
900
+ rec->aHeaders[rec->nHeaders-1].zKey = fossil_strdup(zLine);
901901
sep = strchr(rec->aHeaders[rec->nHeaders-1].zKey, ':');
902902
if( !sep ){
903903
trim_newline(zLine);
904904
fossil_fatal("bad header line: [%s]", zLine);
905905
}
@@ -1426,12 +1426,12 @@
14261426
fossil_free(gsvn.zDate);
14271427
bag_clear(&gsvn.newBranches);
14281428
}
14291429
/* start new revision */
14301430
gsvn.rev = atoi(zTemp);
1431
- gsvn.zUser = mprintf("%s", svn_find_prop(rec, "svn:author"));
1432
- gsvn.zComment = mprintf("%s", svn_find_prop(rec, "svn:log"));
1431
+ gsvn.zUser = fossil_strdup(svn_find_prop(rec, "svn:author"));
1432
+ gsvn.zComment = fossil_strdup(svn_find_prop(rec, "svn:log"));
14331433
zDate = svn_find_prop(rec, "svn:date");
14341434
if( zDate ){
14351435
gsvn.zDate = date_in_standard_format(zDate);
14361436
}else{
14371437
gsvn.zDate = date_in_standard_format("now");
14381438
--- src/import.c
+++ src/import.c
@@ -895,11 +895,11 @@
895 char *sep;
896 if( zLine[0]=='\n' ) break;
897 rec->nHeaders += 1;
898 rec->aHeaders = fossil_realloc(rec->aHeaders,
899 sizeof(rec->aHeaders[0])*rec->nHeaders);
900 rec->aHeaders[rec->nHeaders-1].zKey = mprintf("%s", zLine);
901 sep = strchr(rec->aHeaders[rec->nHeaders-1].zKey, ':');
902 if( !sep ){
903 trim_newline(zLine);
904 fossil_fatal("bad header line: [%s]", zLine);
905 }
@@ -1426,12 +1426,12 @@
1426 fossil_free(gsvn.zDate);
1427 bag_clear(&gsvn.newBranches);
1428 }
1429 /* start new revision */
1430 gsvn.rev = atoi(zTemp);
1431 gsvn.zUser = mprintf("%s", svn_find_prop(rec, "svn:author"));
1432 gsvn.zComment = mprintf("%s", svn_find_prop(rec, "svn:log"));
1433 zDate = svn_find_prop(rec, "svn:date");
1434 if( zDate ){
1435 gsvn.zDate = date_in_standard_format(zDate);
1436 }else{
1437 gsvn.zDate = date_in_standard_format("now");
1438
--- src/import.c
+++ src/import.c
@@ -895,11 +895,11 @@
895 char *sep;
896 if( zLine[0]=='\n' ) break;
897 rec->nHeaders += 1;
898 rec->aHeaders = fossil_realloc(rec->aHeaders,
899 sizeof(rec->aHeaders[0])*rec->nHeaders);
900 rec->aHeaders[rec->nHeaders-1].zKey = fossil_strdup(zLine);
901 sep = strchr(rec->aHeaders[rec->nHeaders-1].zKey, ':');
902 if( !sep ){
903 trim_newline(zLine);
904 fossil_fatal("bad header line: [%s]", zLine);
905 }
@@ -1426,12 +1426,12 @@
1426 fossil_free(gsvn.zDate);
1427 bag_clear(&gsvn.newBranches);
1428 }
1429 /* start new revision */
1430 gsvn.rev = atoi(zTemp);
1431 gsvn.zUser = fossil_strdup(svn_find_prop(rec, "svn:author"));
1432 gsvn.zComment = fossil_strdup(svn_find_prop(rec, "svn:log"));
1433 zDate = svn_find_prop(rec, "svn:date");
1434 if( zDate ){
1435 gsvn.zDate = date_in_standard_format(zDate);
1436 }else{
1437 gsvn.zDate = date_in_standard_format("now");
1438
+3 -3
--- src/info.c
+++ src/info.c
@@ -2886,11 +2886,11 @@
28862886
style_set_current_page("doc/%t/%T", zCI, zName);
28872887
}else if( zCIUuid && zCIUuid[0] ){
28882888
zHeader = mprintf("%s at [%S]", file_tail(zName), zCIUuid);
28892889
style_set_current_page("doc/%S/%T", zCIUuid, zName);
28902890
}else{
2891
- zHeader = mprintf("%s", file_tail(zName));
2891
+ zHeader = fossil_strdup(file_tail(zName));
28922892
style_set_current_page("doc/tip/%T", zName);
28932893
}
28942894
}else if( descOnly ){
28952895
zHeader = mprintf("Artifact Description [%S]", zUuid);
28962896
}else{
@@ -4240,11 +4240,11 @@
42404240
descr->isDirty = -1;
42414241
return (rid-1);
42424242
}
42434243
42444244
zUuid = rid_to_uuid(rid);
4245
- descr->zCommitHash = mprintf("%s", zUuid);
4245
+ descr->zCommitHash = fossil_strdup(zUuid);
42464246
descr->isDirty = unsaved_changes(0);
42474247
42484248
db_multi_exec(
42494249
"DROP TABLE IF EXISTS temp.singletonTag;"
42504250
"CREATE TEMP TABLE singletonTag("
@@ -4289,11 +4289,11 @@
42894289
rid, rid
42904290
);
42914291
42924292
if( db_step(&q)==SQLITE_ROW ){
42934293
const char *lastTag = db_column_text(&q, 0);
4294
- descr->zRelTagname = mprintf("%s", lastTag);
4294
+ descr->zRelTagname = fossil_strdup(lastTag);
42954295
descr->nCommitsSince = db_column_int(&q, 1);
42964296
nRet = 0;
42974297
}else{
42984298
/* no ancestor commit with a fitting singleton tag found */
42994299
descr->zRelTagname = mprintf("");
43004300
--- src/info.c
+++ src/info.c
@@ -2886,11 +2886,11 @@
2886 style_set_current_page("doc/%t/%T", zCI, zName);
2887 }else if( zCIUuid && zCIUuid[0] ){
2888 zHeader = mprintf("%s at [%S]", file_tail(zName), zCIUuid);
2889 style_set_current_page("doc/%S/%T", zCIUuid, zName);
2890 }else{
2891 zHeader = mprintf("%s", file_tail(zName));
2892 style_set_current_page("doc/tip/%T", zName);
2893 }
2894 }else if( descOnly ){
2895 zHeader = mprintf("Artifact Description [%S]", zUuid);
2896 }else{
@@ -4240,11 +4240,11 @@
4240 descr->isDirty = -1;
4241 return (rid-1);
4242 }
4243
4244 zUuid = rid_to_uuid(rid);
4245 descr->zCommitHash = mprintf("%s", zUuid);
4246 descr->isDirty = unsaved_changes(0);
4247
4248 db_multi_exec(
4249 "DROP TABLE IF EXISTS temp.singletonTag;"
4250 "CREATE TEMP TABLE singletonTag("
@@ -4289,11 +4289,11 @@
4289 rid, rid
4290 );
4291
4292 if( db_step(&q)==SQLITE_ROW ){
4293 const char *lastTag = db_column_text(&q, 0);
4294 descr->zRelTagname = mprintf("%s", lastTag);
4295 descr->nCommitsSince = db_column_int(&q, 1);
4296 nRet = 0;
4297 }else{
4298 /* no ancestor commit with a fitting singleton tag found */
4299 descr->zRelTagname = mprintf("");
4300
--- src/info.c
+++ src/info.c
@@ -2886,11 +2886,11 @@
2886 style_set_current_page("doc/%t/%T", zCI, zName);
2887 }else if( zCIUuid && zCIUuid[0] ){
2888 zHeader = mprintf("%s at [%S]", file_tail(zName), zCIUuid);
2889 style_set_current_page("doc/%S/%T", zCIUuid, zName);
2890 }else{
2891 zHeader = fossil_strdup(file_tail(zName));
2892 style_set_current_page("doc/tip/%T", zName);
2893 }
2894 }else if( descOnly ){
2895 zHeader = mprintf("Artifact Description [%S]", zUuid);
2896 }else{
@@ -4240,11 +4240,11 @@
4240 descr->isDirty = -1;
4241 return (rid-1);
4242 }
4243
4244 zUuid = rid_to_uuid(rid);
4245 descr->zCommitHash = fossil_strdup(zUuid);
4246 descr->isDirty = unsaved_changes(0);
4247
4248 db_multi_exec(
4249 "DROP TABLE IF EXISTS temp.singletonTag;"
4250 "CREATE TEMP TABLE singletonTag("
@@ -4289,11 +4289,11 @@
4289 rid, rid
4290 );
4291
4292 if( db_step(&q)==SQLITE_ROW ){
4293 const char *lastTag = db_column_text(&q, 0);
4294 descr->zRelTagname = fossil_strdup(lastTag);
4295 descr->nCommitsSince = db_column_int(&q, 1);
4296 nRet = 0;
4297 }else{
4298 /* no ancestor commit with a fitting singleton tag found */
4299 descr->zRelTagname = mprintf("");
4300
+1 -1
--- src/json.c
+++ src/json.c
@@ -1643,11 +1643,11 @@
16431643
int json_set_err( int code, char const * fmt, ... ){
16441644
assert( (code>=1000) && (code<=9999) );
16451645
fossil_free(g.zErrMsg);
16461646
g.json.resultCode = code;
16471647
if(!fmt || !*fmt){
1648
- g.zErrMsg = mprintf("%s", json_err_cstr(code));
1648
+ g.zErrMsg = fossil_strdup(json_err_cstr(code));
16491649
}else{
16501650
va_list vargs;
16511651
char * msg;
16521652
va_start(vargs,fmt);
16531653
msg = vmprintf(fmt, vargs);
16541654
--- src/json.c
+++ src/json.c
@@ -1643,11 +1643,11 @@
1643 int json_set_err( int code, char const * fmt, ... ){
1644 assert( (code>=1000) && (code<=9999) );
1645 fossil_free(g.zErrMsg);
1646 g.json.resultCode = code;
1647 if(!fmt || !*fmt){
1648 g.zErrMsg = mprintf("%s", json_err_cstr(code));
1649 }else{
1650 va_list vargs;
1651 char * msg;
1652 va_start(vargs,fmt);
1653 msg = vmprintf(fmt, vargs);
1654
--- src/json.c
+++ src/json.c
@@ -1643,11 +1643,11 @@
1643 int json_set_err( int code, char const * fmt, ... ){
1644 assert( (code>=1000) && (code<=9999) );
1645 fossil_free(g.zErrMsg);
1646 g.json.resultCode = code;
1647 if(!fmt || !*fmt){
1648 g.zErrMsg = fossil_strdup(json_err_cstr(code));
1649 }else{
1650 va_list vargs;
1651 char * msg;
1652 va_start(vargs,fmt);
1653 msg = vmprintf(fmt, vargs);
1654
--- src/json_report.c
+++ src/json_report.c
@@ -202,11 +202,11 @@
202202
limit = json_find_option_int("limit",NULL,"n",-1);
203203
204204
205205
/* Copy over report's SQL...*/
206206
blob_append(&sql, db_column_text(&q,0), -1);
207
- zTitle = mprintf("%s", db_column_text(&q,1));
207
+ zTitle = fossil_strdup(db_column_text(&q,1));
208208
db_finalize(&q);
209209
db_prepare(&q, "%s", blob_sql_text(&sql));
210210
211211
/** Build the response... */
212212
pay = cson_new_object();
213213
--- src/json_report.c
+++ src/json_report.c
@@ -202,11 +202,11 @@
202 limit = json_find_option_int("limit",NULL,"n",-1);
203
204
205 /* Copy over report's SQL...*/
206 blob_append(&sql, db_column_text(&q,0), -1);
207 zTitle = mprintf("%s", db_column_text(&q,1));
208 db_finalize(&q);
209 db_prepare(&q, "%s", blob_sql_text(&sql));
210
211 /** Build the response... */
212 pay = cson_new_object();
213
--- src/json_report.c
+++ src/json_report.c
@@ -202,11 +202,11 @@
202 limit = json_find_option_int("limit",NULL,"n",-1);
203
204
205 /* Copy over report's SQL...*/
206 blob_append(&sql, db_column_text(&q,0), -1);
207 zTitle = fossil_strdup(db_column_text(&q,1));
208 db_finalize(&q);
209 db_prepare(&q, "%s", blob_sql_text(&sql));
210
211 /** Build the response... */
212 pay = cson_new_object();
213
+14 -14
--- src/main.c
+++ src/main.c
@@ -1139,11 +1139,11 @@
11391139
*/
11401140
const char *find_repository_option(){
11411141
const char *zRepository = find_option("repository", "R", 1);
11421142
if( zRepository ){
11431143
if( g.zRepositoryOption ) fossil_free(g.zRepositoryOption);
1144
- g.zRepositoryOption = mprintf("%s", zRepository);
1144
+ g.zRepositoryOption = fossil_strdup(zRepository);
11451145
}
11461146
return g.zRepositoryOption;
11471147
}
11481148
11491149
/*
@@ -1385,20 +1385,20 @@
13851385
const char *zCur;
13861386
13871387
if( g.zBaseURL!=0 ) return;
13881388
if( zAltBase ){
13891389
int i, n, c;
1390
- g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1390
+ g.zTop = g.zBaseURL = fossil_strdup(zAltBase);
13911391
i = (int)strlen(g.zBaseURL);
13921392
while( i>3 && g.zBaseURL[i-1]=='/' ){ i--; }
13931393
g.zBaseURL[i] = 0;
13941394
if( strncmp(g.zTop, "http://", 7)==0 ){
13951395
/* it is HTTP, replace prefix with HTTPS. */
13961396
g.zHttpsURL = mprintf("https://%s", &g.zTop[7]);
13971397
}else if( strncmp(g.zTop, "https://", 8)==0 ){
13981398
/* it is already HTTPS, use it. */
1399
- g.zHttpsURL = mprintf("%s", g.zTop);
1399
+ g.zHttpsURL = fossil_strdup(g.zTop);
14001400
}else{
14011401
fossil_fatal("argument to --baseurl should be 'http://host/path'"
14021402
" or 'https://host/path'");
14031403
}
14041404
for(i=n=0; (c = g.zTop[i])!=0; i++){
@@ -2071,11 +2071,11 @@
20712071
cgi_redirectf("%R/ckout");
20722072
}else{
20732073
fossil_redirect_home() /*does not return*/;
20742074
}
20752075
}else{
2076
- zPath = mprintf("%s", zPathInfo);
2076
+ zPath = fossil_strdup(zPathInfo);
20772077
}
20782078
20792079
/* Make g.zPath point to the first element of the path. Make
20802080
** g.zExtra point to everything past that point.
20812081
*/
@@ -2482,21 +2482,21 @@
24822482
** If repository: is omitted, then terms of the PATH_INFO cgi parameter
24832483
** are appended to DIRECTORY looking for a repository (whose name ends
24842484
** in ".fossil") or a file in "files:".
24852485
*/
24862486
db_close(1);
2487
- g.zRepositoryName = mprintf("%s", blob_str(&value));
2487
+ g.zRepositoryName = fossil_strdup(blob_str(&value));
24882488
blob_reset(&value);
24892489
continue;
24902490
}
24912491
if( blob_eq(&key, "notfound:") && blob_token(&line, &value) ){
24922492
/* notfound: URL
24932493
**
24942494
** If using directory: and no suitable repository or file is found,
24952495
** then redirect to URL.
24962496
*/
2497
- zNotFound = mprintf("%s", blob_str(&value));
2497
+ zNotFound = fossil_strdup(blob_str(&value));
24982498
blob_reset(&value);
24992499
continue;
25002500
}
25012501
if( blob_eq(&key, "localauth") ){
25022502
/* localauth
@@ -2536,12 +2536,12 @@
25362536
&& blob_token(&line, &value2) ){
25372537
/* See the header comment on the redirect_web_page() function
25382538
** above for details. */
25392539
nRedirect++;
25402540
azRedirect = fossil_realloc(azRedirect, 2*nRedirect*sizeof(char*));
2541
- azRedirect[nRedirect*2-2] = mprintf("%s", blob_str(&value));
2542
- azRedirect[nRedirect*2-1] = mprintf("%s", blob_str(&value2));
2541
+ azRedirect[nRedirect*2-2] = fossil_strdup(blob_str(&value));
2542
+ azRedirect[nRedirect*2-1] = fossil_strdup(blob_str(&value2));
25432543
blob_reset(&value);
25442544
blob_reset(&value2);
25452545
continue;
25462546
}
25472547
if( blob_eq(&key, "files:") && blob_token(&line, &value) ){
@@ -2580,20 +2580,20 @@
25802580
/* errorlog: FILENAME
25812581
**
25822582
** Causes messages from warnings, errors, and panics to be appended
25832583
** to FILENAME.
25842584
*/
2585
- g.zErrlog = mprintf("%s", blob_str(&value));
2585
+ g.zErrlog = fossil_strdup(blob_str(&value));
25862586
blob_reset(&value);
25872587
continue;
25882588
}
25892589
if( blob_eq(&key, "extroot:") && blob_token(&line, &value) ){
25902590
/* extroot: DIRECTORY
25912591
**
25922592
** Enables the /ext webpage to use sub-cgi rooted at DIRECTORY
25932593
*/
2594
- g.zExtRoot = mprintf("%s", blob_str(&value));
2594
+ g.zExtRoot = fossil_strdup(blob_str(&value));
25952595
blob_reset(&value);
25962596
continue;
25972597
}
25982598
if( blob_eq(&key, "timeout:") && blob_token(&line, &value) ){
25992599
/* timeout: SECONDS
@@ -2650,11 +2650,11 @@
26502650
**
26512651
** Use the contents of FILENAME as the value of the site's
26522652
** "mainmenu" setting, overriding the contents (for this
26532653
** request) of the db-side setting or the hard-coded default.
26542654
*/
2655
- g.zMainMenuFile = mprintf("%s", blob_str(&value));
2655
+ g.zMainMenuFile = fossil_strdup(blob_str(&value));
26562656
blob_reset(&value);
26572657
continue;
26582658
}
26592659
if( blob_eq(&key, "cgi-debug:") && blob_token(&line, &value) ){
26602660
/* cgi-debug: FILENAME
@@ -2707,11 +2707,11 @@
27072707
db_must_be_within_tree();
27082708
}else{
27092709
const char *zRepo = g.argv[arg];
27102710
int isDir = file_isdir(zRepo, ExtFILE);
27112711
if( isDir==1 ){
2712
- g.zRepositoryName = mprintf("%s", zRepo);
2712
+ g.zRepositoryName = fossil_strdup(zRepo);
27132713
file_simplify_name(g.zRepositoryName, -1, 0);
27142714
}else{
27152715
if( isDir==0 && fCreate ){
27162716
const char *zPassword;
27172717
db_create_repository(zRepo);
@@ -2919,11 +2919,11 @@
29192919
** the argument being URL encoded, to avoid wildcard expansion in the
29202920
** shell. This option is for internal use and is undocumented.
29212921
*/
29222922
zFileGlob = find_option("files-urlenc",0,1);
29232923
if( zFileGlob ){
2924
- char *z = mprintf("%s", zFileGlob);
2924
+ char *z = fossil_strdup(zFileGlob);
29252925
dehttpize(z);
29262926
zFileGlob = z;
29272927
}else{
29282928
zFileGlob = find_option("files",0,1);
29292929
}
@@ -3329,11 +3329,11 @@
33293329
g.zExtRoot = find_option("extroot",0,1);
33303330
zJsMode = find_option("jsmode",0,1);
33313331
builtin_set_js_delivery_mode(zJsMode,0);
33323332
zFileGlob = find_option("files-urlenc",0,1);
33333333
if( zFileGlob ){
3334
- char *z = mprintf("%s", zFileGlob);
3334
+ char *z = fossil_strdup(zFileGlob);
33353335
dehttpize(z);
33363336
zFileGlob = z;
33373337
}else{
33383338
zFileGlob = find_option("files",0,1);
33393339
}
33403340
--- src/main.c
+++ src/main.c
@@ -1139,11 +1139,11 @@
1139 */
1140 const char *find_repository_option(){
1141 const char *zRepository = find_option("repository", "R", 1);
1142 if( zRepository ){
1143 if( g.zRepositoryOption ) fossil_free(g.zRepositoryOption);
1144 g.zRepositoryOption = mprintf("%s", zRepository);
1145 }
1146 return g.zRepositoryOption;
1147 }
1148
1149 /*
@@ -1385,20 +1385,20 @@
1385 const char *zCur;
1386
1387 if( g.zBaseURL!=0 ) return;
1388 if( zAltBase ){
1389 int i, n, c;
1390 g.zTop = g.zBaseURL = mprintf("%s", zAltBase);
1391 i = (int)strlen(g.zBaseURL);
1392 while( i>3 && g.zBaseURL[i-1]=='/' ){ i--; }
1393 g.zBaseURL[i] = 0;
1394 if( strncmp(g.zTop, "http://", 7)==0 ){
1395 /* it is HTTP, replace prefix with HTTPS. */
1396 g.zHttpsURL = mprintf("https://%s", &g.zTop[7]);
1397 }else if( strncmp(g.zTop, "https://", 8)==0 ){
1398 /* it is already HTTPS, use it. */
1399 g.zHttpsURL = mprintf("%s", g.zTop);
1400 }else{
1401 fossil_fatal("argument to --baseurl should be 'http://host/path'"
1402 " or 'https://host/path'");
1403 }
1404 for(i=n=0; (c = g.zTop[i])!=0; i++){
@@ -2071,11 +2071,11 @@
2071 cgi_redirectf("%R/ckout");
2072 }else{
2073 fossil_redirect_home() /*does not return*/;
2074 }
2075 }else{
2076 zPath = mprintf("%s", zPathInfo);
2077 }
2078
2079 /* Make g.zPath point to the first element of the path. Make
2080 ** g.zExtra point to everything past that point.
2081 */
@@ -2482,21 +2482,21 @@
2482 ** If repository: is omitted, then terms of the PATH_INFO cgi parameter
2483 ** are appended to DIRECTORY looking for a repository (whose name ends
2484 ** in ".fossil") or a file in "files:".
2485 */
2486 db_close(1);
2487 g.zRepositoryName = mprintf("%s", blob_str(&value));
2488 blob_reset(&value);
2489 continue;
2490 }
2491 if( blob_eq(&key, "notfound:") && blob_token(&line, &value) ){
2492 /* notfound: URL
2493 **
2494 ** If using directory: and no suitable repository or file is found,
2495 ** then redirect to URL.
2496 */
2497 zNotFound = mprintf("%s", blob_str(&value));
2498 blob_reset(&value);
2499 continue;
2500 }
2501 if( blob_eq(&key, "localauth") ){
2502 /* localauth
@@ -2536,12 +2536,12 @@
2536 && blob_token(&line, &value2) ){
2537 /* See the header comment on the redirect_web_page() function
2538 ** above for details. */
2539 nRedirect++;
2540 azRedirect = fossil_realloc(azRedirect, 2*nRedirect*sizeof(char*));
2541 azRedirect[nRedirect*2-2] = mprintf("%s", blob_str(&value));
2542 azRedirect[nRedirect*2-1] = mprintf("%s", blob_str(&value2));
2543 blob_reset(&value);
2544 blob_reset(&value2);
2545 continue;
2546 }
2547 if( blob_eq(&key, "files:") && blob_token(&line, &value) ){
@@ -2580,20 +2580,20 @@
2580 /* errorlog: FILENAME
2581 **
2582 ** Causes messages from warnings, errors, and panics to be appended
2583 ** to FILENAME.
2584 */
2585 g.zErrlog = mprintf("%s", blob_str(&value));
2586 blob_reset(&value);
2587 continue;
2588 }
2589 if( blob_eq(&key, "extroot:") && blob_token(&line, &value) ){
2590 /* extroot: DIRECTORY
2591 **
2592 ** Enables the /ext webpage to use sub-cgi rooted at DIRECTORY
2593 */
2594 g.zExtRoot = mprintf("%s", blob_str(&value));
2595 blob_reset(&value);
2596 continue;
2597 }
2598 if( blob_eq(&key, "timeout:") && blob_token(&line, &value) ){
2599 /* timeout: SECONDS
@@ -2650,11 +2650,11 @@
2650 **
2651 ** Use the contents of FILENAME as the value of the site's
2652 ** "mainmenu" setting, overriding the contents (for this
2653 ** request) of the db-side setting or the hard-coded default.
2654 */
2655 g.zMainMenuFile = mprintf("%s", blob_str(&value));
2656 blob_reset(&value);
2657 continue;
2658 }
2659 if( blob_eq(&key, "cgi-debug:") && blob_token(&line, &value) ){
2660 /* cgi-debug: FILENAME
@@ -2707,11 +2707,11 @@
2707 db_must_be_within_tree();
2708 }else{
2709 const char *zRepo = g.argv[arg];
2710 int isDir = file_isdir(zRepo, ExtFILE);
2711 if( isDir==1 ){
2712 g.zRepositoryName = mprintf("%s", zRepo);
2713 file_simplify_name(g.zRepositoryName, -1, 0);
2714 }else{
2715 if( isDir==0 && fCreate ){
2716 const char *zPassword;
2717 db_create_repository(zRepo);
@@ -2919,11 +2919,11 @@
2919 ** the argument being URL encoded, to avoid wildcard expansion in the
2920 ** shell. This option is for internal use and is undocumented.
2921 */
2922 zFileGlob = find_option("files-urlenc",0,1);
2923 if( zFileGlob ){
2924 char *z = mprintf("%s", zFileGlob);
2925 dehttpize(z);
2926 zFileGlob = z;
2927 }else{
2928 zFileGlob = find_option("files",0,1);
2929 }
@@ -3329,11 +3329,11 @@
3329 g.zExtRoot = find_option("extroot",0,1);
3330 zJsMode = find_option("jsmode",0,1);
3331 builtin_set_js_delivery_mode(zJsMode,0);
3332 zFileGlob = find_option("files-urlenc",0,1);
3333 if( zFileGlob ){
3334 char *z = mprintf("%s", zFileGlob);
3335 dehttpize(z);
3336 zFileGlob = z;
3337 }else{
3338 zFileGlob = find_option("files",0,1);
3339 }
3340
--- src/main.c
+++ src/main.c
@@ -1139,11 +1139,11 @@
1139 */
1140 const char *find_repository_option(){
1141 const char *zRepository = find_option("repository", "R", 1);
1142 if( zRepository ){
1143 if( g.zRepositoryOption ) fossil_free(g.zRepositoryOption);
1144 g.zRepositoryOption = fossil_strdup(zRepository);
1145 }
1146 return g.zRepositoryOption;
1147 }
1148
1149 /*
@@ -1385,20 +1385,20 @@
1385 const char *zCur;
1386
1387 if( g.zBaseURL!=0 ) return;
1388 if( zAltBase ){
1389 int i, n, c;
1390 g.zTop = g.zBaseURL = fossil_strdup(zAltBase);
1391 i = (int)strlen(g.zBaseURL);
1392 while( i>3 && g.zBaseURL[i-1]=='/' ){ i--; }
1393 g.zBaseURL[i] = 0;
1394 if( strncmp(g.zTop, "http://", 7)==0 ){
1395 /* it is HTTP, replace prefix with HTTPS. */
1396 g.zHttpsURL = mprintf("https://%s", &g.zTop[7]);
1397 }else if( strncmp(g.zTop, "https://", 8)==0 ){
1398 /* it is already HTTPS, use it. */
1399 g.zHttpsURL = fossil_strdup(g.zTop);
1400 }else{
1401 fossil_fatal("argument to --baseurl should be 'http://host/path'"
1402 " or 'https://host/path'");
1403 }
1404 for(i=n=0; (c = g.zTop[i])!=0; i++){
@@ -2071,11 +2071,11 @@
2071 cgi_redirectf("%R/ckout");
2072 }else{
2073 fossil_redirect_home() /*does not return*/;
2074 }
2075 }else{
2076 zPath = fossil_strdup(zPathInfo);
2077 }
2078
2079 /* Make g.zPath point to the first element of the path. Make
2080 ** g.zExtra point to everything past that point.
2081 */
@@ -2482,21 +2482,21 @@
2482 ** If repository: is omitted, then terms of the PATH_INFO cgi parameter
2483 ** are appended to DIRECTORY looking for a repository (whose name ends
2484 ** in ".fossil") or a file in "files:".
2485 */
2486 db_close(1);
2487 g.zRepositoryName = fossil_strdup(blob_str(&value));
2488 blob_reset(&value);
2489 continue;
2490 }
2491 if( blob_eq(&key, "notfound:") && blob_token(&line, &value) ){
2492 /* notfound: URL
2493 **
2494 ** If using directory: and no suitable repository or file is found,
2495 ** then redirect to URL.
2496 */
2497 zNotFound = fossil_strdup(blob_str(&value));
2498 blob_reset(&value);
2499 continue;
2500 }
2501 if( blob_eq(&key, "localauth") ){
2502 /* localauth
@@ -2536,12 +2536,12 @@
2536 && blob_token(&line, &value2) ){
2537 /* See the header comment on the redirect_web_page() function
2538 ** above for details. */
2539 nRedirect++;
2540 azRedirect = fossil_realloc(azRedirect, 2*nRedirect*sizeof(char*));
2541 azRedirect[nRedirect*2-2] = fossil_strdup(blob_str(&value));
2542 azRedirect[nRedirect*2-1] = fossil_strdup(blob_str(&value2));
2543 blob_reset(&value);
2544 blob_reset(&value2);
2545 continue;
2546 }
2547 if( blob_eq(&key, "files:") && blob_token(&line, &value) ){
@@ -2580,20 +2580,20 @@
2580 /* errorlog: FILENAME
2581 **
2582 ** Causes messages from warnings, errors, and panics to be appended
2583 ** to FILENAME.
2584 */
2585 g.zErrlog = fossil_strdup(blob_str(&value));
2586 blob_reset(&value);
2587 continue;
2588 }
2589 if( blob_eq(&key, "extroot:") && blob_token(&line, &value) ){
2590 /* extroot: DIRECTORY
2591 **
2592 ** Enables the /ext webpage to use sub-cgi rooted at DIRECTORY
2593 */
2594 g.zExtRoot = fossil_strdup(blob_str(&value));
2595 blob_reset(&value);
2596 continue;
2597 }
2598 if( blob_eq(&key, "timeout:") && blob_token(&line, &value) ){
2599 /* timeout: SECONDS
@@ -2650,11 +2650,11 @@
2650 **
2651 ** Use the contents of FILENAME as the value of the site's
2652 ** "mainmenu" setting, overriding the contents (for this
2653 ** request) of the db-side setting or the hard-coded default.
2654 */
2655 g.zMainMenuFile = fossil_strdup(blob_str(&value));
2656 blob_reset(&value);
2657 continue;
2658 }
2659 if( blob_eq(&key, "cgi-debug:") && blob_token(&line, &value) ){
2660 /* cgi-debug: FILENAME
@@ -2707,11 +2707,11 @@
2707 db_must_be_within_tree();
2708 }else{
2709 const char *zRepo = g.argv[arg];
2710 int isDir = file_isdir(zRepo, ExtFILE);
2711 if( isDir==1 ){
2712 g.zRepositoryName = fossil_strdup(zRepo);
2713 file_simplify_name(g.zRepositoryName, -1, 0);
2714 }else{
2715 if( isDir==0 && fCreate ){
2716 const char *zPassword;
2717 db_create_repository(zRepo);
@@ -2919,11 +2919,11 @@
2919 ** the argument being URL encoded, to avoid wildcard expansion in the
2920 ** shell. This option is for internal use and is undocumented.
2921 */
2922 zFileGlob = find_option("files-urlenc",0,1);
2923 if( zFileGlob ){
2924 char *z = fossil_strdup(zFileGlob);
2925 dehttpize(z);
2926 zFileGlob = z;
2927 }else{
2928 zFileGlob = find_option("files",0,1);
2929 }
@@ -3329,11 +3329,11 @@
3329 g.zExtRoot = find_option("extroot",0,1);
3330 zJsMode = find_option("jsmode",0,1);
3331 builtin_set_js_delivery_mode(zJsMode,0);
3332 zFileGlob = find_option("files-urlenc",0,1);
3333 if( zFileGlob ){
3334 char *z = fossil_strdup(zFileGlob);
3335 dehttpize(z);
3336 zFileGlob = z;
3337 }else{
3338 zFileGlob = find_option("files",0,1);
3339 }
3340
+1 -1
--- src/merge.c
+++ src/merge.c
@@ -481,11 +481,11 @@
481481
const char *zTagList = db_column_text(&q, 4);
482482
char *zCom;
483483
if( zTagList && zTagList[0] ){
484484
zCom = mprintf("%s (%s)", db_column_text(&q, 2), zTagList);
485485
}else{
486
- zCom = mprintf("%s", db_column_text(&q,2));
486
+ zCom = fossil_strdup(db_column_text(&q,2));
487487
}
488488
fossil_print("%-*s [%S] by %s on %s\n%*s",
489489
indent-1, zLabel,
490490
db_column_text(&q, 3),
491491
db_column_text(&q, 1),
492492
--- src/merge.c
+++ src/merge.c
@@ -481,11 +481,11 @@
481 const char *zTagList = db_column_text(&q, 4);
482 char *zCom;
483 if( zTagList && zTagList[0] ){
484 zCom = mprintf("%s (%s)", db_column_text(&q, 2), zTagList);
485 }else{
486 zCom = mprintf("%s", db_column_text(&q,2));
487 }
488 fossil_print("%-*s [%S] by %s on %s\n%*s",
489 indent-1, zLabel,
490 db_column_text(&q, 3),
491 db_column_text(&q, 1),
492
--- src/merge.c
+++ src/merge.c
@@ -481,11 +481,11 @@
481 const char *zTagList = db_column_text(&q, 4);
482 char *zCom;
483 if( zTagList && zTagList[0] ){
484 zCom = mprintf("%s (%s)", db_column_text(&q, 2), zTagList);
485 }else{
486 zCom = fossil_strdup(db_column_text(&q,2));
487 }
488 fossil_print("%-*s [%S] by %s on %s\n%*s",
489 indent-1, zLabel,
490 db_column_text(&q, 3),
491 db_column_text(&q, 1),
492
+2 -2
--- src/name.c
+++ src/name.c
@@ -581,11 +581,11 @@
581581
nTag = strlen(zTag);
582582
for(i=0; i<nTag-8 && zTag[i]!=':'; i++){}
583583
if( zTag[i]==':'
584584
&& (fossil_isdate(&zTag[i+1]) || fossil_expand_datetime(&zTag[i+1],0,0)!=0)
585585
){
586
- char *zDate = mprintf("%s", &zTag[i+1]);
586
+ char *zDate = fossil_strdup(&zTag[i+1]);
587587
char *zTagBase = mprintf("%.*s", i, zTag);
588588
char *zXDate;
589589
int nDate = strlen(zDate);
590590
if( sqlite3_strnicmp(&zDate[nDate-3],"utc",3)==0 ){
591591
zDate[nDate-3] = 'z';
@@ -986,11 +986,11 @@
986986
}
987987
style_header("Ambiguous Artifact ID");
988988
@ <p>The artifact hash prefix <b>%h(zName)</b> is ambiguous and might
989989
@ mean any of the following:
990990
@ <ol>
991
- z = mprintf("%s", zName);
991
+ z = fossil_strdup(zName);
992992
canonical16(z, strlen(z));
993993
db_prepare(&q, "SELECT uuid, rid FROM blob WHERE uuid GLOB '%q*'", z);
994994
while( db_step(&q)==SQLITE_ROW ){
995995
const char *zUuid = db_column_text(&q, 0);
996996
int rid = db_column_int(&q, 1);
997997
--- src/name.c
+++ src/name.c
@@ -581,11 +581,11 @@
581 nTag = strlen(zTag);
582 for(i=0; i<nTag-8 && zTag[i]!=':'; i++){}
583 if( zTag[i]==':'
584 && (fossil_isdate(&zTag[i+1]) || fossil_expand_datetime(&zTag[i+1],0,0)!=0)
585 ){
586 char *zDate = mprintf("%s", &zTag[i+1]);
587 char *zTagBase = mprintf("%.*s", i, zTag);
588 char *zXDate;
589 int nDate = strlen(zDate);
590 if( sqlite3_strnicmp(&zDate[nDate-3],"utc",3)==0 ){
591 zDate[nDate-3] = 'z';
@@ -986,11 +986,11 @@
986 }
987 style_header("Ambiguous Artifact ID");
988 @ <p>The artifact hash prefix <b>%h(zName)</b> is ambiguous and might
989 @ mean any of the following:
990 @ <ol>
991 z = mprintf("%s", zName);
992 canonical16(z, strlen(z));
993 db_prepare(&q, "SELECT uuid, rid FROM blob WHERE uuid GLOB '%q*'", z);
994 while( db_step(&q)==SQLITE_ROW ){
995 const char *zUuid = db_column_text(&q, 0);
996 int rid = db_column_int(&q, 1);
997
--- src/name.c
+++ src/name.c
@@ -581,11 +581,11 @@
581 nTag = strlen(zTag);
582 for(i=0; i<nTag-8 && zTag[i]!=':'; i++){}
583 if( zTag[i]==':'
584 && (fossil_isdate(&zTag[i+1]) || fossil_expand_datetime(&zTag[i+1],0,0)!=0)
585 ){
586 char *zDate = fossil_strdup(&zTag[i+1]);
587 char *zTagBase = mprintf("%.*s", i, zTag);
588 char *zXDate;
589 int nDate = strlen(zDate);
590 if( sqlite3_strnicmp(&zDate[nDate-3],"utc",3)==0 ){
591 zDate[nDate-3] = 'z';
@@ -986,11 +986,11 @@
986 }
987 style_header("Ambiguous Artifact ID");
988 @ <p>The artifact hash prefix <b>%h(zName)</b> is ambiguous and might
989 @ mean any of the following:
990 @ <ol>
991 z = fossil_strdup(zName);
992 canonical16(z, strlen(z));
993 db_prepare(&q, "SELECT uuid, rid FROM blob WHERE uuid GLOB '%q*'", z);
994 while( db_step(&q)==SQLITE_ROW ){
995 const char *zUuid = db_column_text(&q, 0);
996 int rid = db_column_int(&q, 1);
997
+3 -3
--- src/repolist.c
+++ src/repolist.c
@@ -247,22 +247,22 @@
247247
if( zName[0]=='/'
248248
#ifdef _WIN32
249249
|| sqlite3_strglob("[a-zA-Z]:/*", zName)==0
250250
#endif
251251
){
252
- zFull = mprintf("%s", zName);
252
+ zFull = fossil_strdup(zName);
253253
}else if ( allRepo ){
254254
zFull = mprintf("/%s", zName);
255255
}else{
256256
zFull = mprintf("%s/%s", g.zRepositoryName, zName);
257257
}
258258
x.zRepoName = zFull;
259259
remote_repo_info(&x);
260260
if( x.isRepolistSkin ){
261261
if( zSkinRepo==0 ){
262
- zSkinRepo = mprintf("%s", x.zRepoName);
263
- zSkinUrl = mprintf("%s", zUrl);
262
+ zSkinRepo = fossil_strdup(x.zRepoName);
263
+ zSkinUrl = fossil_strdup(zUrl);
264264
}
265265
}
266266
fossil_free(zFull);
267267
if( !x.isValid
268268
#if USE_SEE
269269
--- src/repolist.c
+++ src/repolist.c
@@ -247,22 +247,22 @@
247 if( zName[0]=='/'
248 #ifdef _WIN32
249 || sqlite3_strglob("[a-zA-Z]:/*", zName)==0
250 #endif
251 ){
252 zFull = mprintf("%s", zName);
253 }else if ( allRepo ){
254 zFull = mprintf("/%s", zName);
255 }else{
256 zFull = mprintf("%s/%s", g.zRepositoryName, zName);
257 }
258 x.zRepoName = zFull;
259 remote_repo_info(&x);
260 if( x.isRepolistSkin ){
261 if( zSkinRepo==0 ){
262 zSkinRepo = mprintf("%s", x.zRepoName);
263 zSkinUrl = mprintf("%s", zUrl);
264 }
265 }
266 fossil_free(zFull);
267 if( !x.isValid
268 #if USE_SEE
269
--- src/repolist.c
+++ src/repolist.c
@@ -247,22 +247,22 @@
247 if( zName[0]=='/'
248 #ifdef _WIN32
249 || sqlite3_strglob("[a-zA-Z]:/*", zName)==0
250 #endif
251 ){
252 zFull = fossil_strdup(zName);
253 }else if ( allRepo ){
254 zFull = mprintf("/%s", zName);
255 }else{
256 zFull = mprintf("%s/%s", g.zRepositoryName, zName);
257 }
258 x.zRepoName = zFull;
259 remote_repo_info(&x);
260 if( x.isRepolistSkin ){
261 if( zSkinRepo==0 ){
262 zSkinRepo = fossil_strdup(x.zRepoName);
263 zSkinUrl = fossil_strdup(zUrl);
264 }
265 }
266 fossil_free(zFull);
267 if( !x.isValid
268 #if USE_SEE
269
+5 -5
--- src/search.c
+++ src/search.c
@@ -130,14 +130,14 @@
130130
search_end(p);
131131
}else{
132132
p = fossil_malloc(sizeof(*p));
133133
memset(p, 0, sizeof(*p));
134134
}
135
- p->zPattern = z = mprintf("%s", zPattern);
136
- p->zMarkBegin = mprintf("%s", zMarkBegin);
137
- p->zMarkEnd = mprintf("%s", zMarkEnd);
138
- p->zMarkGap = mprintf("%s", zMarkGap);
135
+ p->zPattern = z = fossil_strdup(zPattern);
136
+ p->zMarkBegin = fossil_strdup(zMarkBegin);
137
+ p->zMarkEnd = fossil_strdup(zMarkEnd);
138
+ p->zMarkGap = fossil_strdup(zMarkGap);
139139
p->fSrchFlg = fSrchFlg;
140140
blob_init(&p->snip, 0, 0);
141141
while( *z && p->nTerm<SEARCH_MAX_TERM ){
142142
while( *z && !ISALNUM(*z) ){ z++; }
143143
if( *z==0 ) break;
@@ -1076,11 +1076,11 @@
10761076
** causing errors in FTS5 searches with inputs which contain AND, OR,
10771077
** and symbols like #. The caller is responsible for passing the
10781078
** result to fossil_free().
10791079
*/
10801080
char *search_simplify_pattern(const char * zPattern){
1081
- char *zPat = mprintf("%s",zPattern);
1081
+ char *zPat = fossil_strdup(zPattern);
10821082
int i;
10831083
for(i=0; zPat[i]; i++){
10841084
if( (zPat[i]&0x80)==0 && !fossil_isalnum(zPat[i]) ) zPat[i] = ' ';
10851085
if( fossil_isupper(zPat[i]) ) zPat[i] = fossil_tolower(zPat[i]);
10861086
}
10871087
--- src/search.c
+++ src/search.c
@@ -130,14 +130,14 @@
130 search_end(p);
131 }else{
132 p = fossil_malloc(sizeof(*p));
133 memset(p, 0, sizeof(*p));
134 }
135 p->zPattern = z = mprintf("%s", zPattern);
136 p->zMarkBegin = mprintf("%s", zMarkBegin);
137 p->zMarkEnd = mprintf("%s", zMarkEnd);
138 p->zMarkGap = mprintf("%s", zMarkGap);
139 p->fSrchFlg = fSrchFlg;
140 blob_init(&p->snip, 0, 0);
141 while( *z && p->nTerm<SEARCH_MAX_TERM ){
142 while( *z && !ISALNUM(*z) ){ z++; }
143 if( *z==0 ) break;
@@ -1076,11 +1076,11 @@
1076 ** causing errors in FTS5 searches with inputs which contain AND, OR,
1077 ** and symbols like #. The caller is responsible for passing the
1078 ** result to fossil_free().
1079 */
1080 char *search_simplify_pattern(const char * zPattern){
1081 char *zPat = mprintf("%s",zPattern);
1082 int i;
1083 for(i=0; zPat[i]; i++){
1084 if( (zPat[i]&0x80)==0 && !fossil_isalnum(zPat[i]) ) zPat[i] = ' ';
1085 if( fossil_isupper(zPat[i]) ) zPat[i] = fossil_tolower(zPat[i]);
1086 }
1087
--- src/search.c
+++ src/search.c
@@ -130,14 +130,14 @@
130 search_end(p);
131 }else{
132 p = fossil_malloc(sizeof(*p));
133 memset(p, 0, sizeof(*p));
134 }
135 p->zPattern = z = fossil_strdup(zPattern);
136 p->zMarkBegin = fossil_strdup(zMarkBegin);
137 p->zMarkEnd = fossil_strdup(zMarkEnd);
138 p->zMarkGap = fossil_strdup(zMarkGap);
139 p->fSrchFlg = fSrchFlg;
140 blob_init(&p->snip, 0, 0);
141 while( *z && p->nTerm<SEARCH_MAX_TERM ){
142 while( *z && !ISALNUM(*z) ){ z++; }
143 if( *z==0 ) break;
@@ -1076,11 +1076,11 @@
1076 ** causing errors in FTS5 searches with inputs which contain AND, OR,
1077 ** and symbols like #. The caller is responsible for passing the
1078 ** result to fossil_free().
1079 */
1080 char *search_simplify_pattern(const char * zPattern){
1081 char *zPat = fossil_strdup(zPattern);
1082 int i;
1083 for(i=0; zPat[i]; i++){
1084 if( (zPat[i]&0x80)==0 && !fossil_isalnum(zPat[i]) ) zPat[i] = ' ';
1085 if( fossil_isupper(zPat[i]) ) zPat[i] = fossil_tolower(zPat[i]);
1086 }
1087
+3 -3
--- src/sha1.c
+++ src/sha1.c
@@ -420,11 +420,11 @@
420420
421421
SHA1Init(&ctx);
422422
SHA1Update(&ctx, (unsigned const char*)zIn, strlen(zIn));
423423
SHA1Final(zResult, &ctx);
424424
DigestToBase16(zResult, zDigest);
425
- return mprintf("%s", zDigest);
425
+ return fossil_strdup(zDigest);
426426
}
427427
428428
/*
429429
** Convert a cleartext password for a specific user into a SHA1 hash.
430430
**
@@ -459,11 +459,11 @@
459459
460460
/* On the first xfer request of a clone, the project-code is not yet
461461
** known. Use the cleartext password, since that is all we have.
462462
*/
463463
if( zProjectId==0 ){
464
- return mprintf("%s", zPw);
464
+ return fossil_strdup(zPw);
465465
}
466466
}
467467
zProjCode = zProjectId;
468468
}
469469
SHA1Update(&ctx, (unsigned char*)zProjCode, strlen(zProjCode));
@@ -471,11 +471,11 @@
471471
SHA1Update(&ctx, (unsigned char*)zLogin, strlen(zLogin));
472472
SHA1Update(&ctx, (unsigned char*)"/", 1);
473473
SHA1Update(&ctx, (unsigned const char*)zPw, strlen(zPw));
474474
SHA1Final(zResult, &ctx);
475475
DigestToBase16(zResult, zDigest);
476
- return mprintf("%s", zDigest);
476
+ return fossil_strdup(zDigest);
477477
}
478478
479479
/*
480480
** Implement the shared_secret() SQL function. shared_secret() takes two or
481481
** three arguments; the third argument is optional.
482482
--- src/sha1.c
+++ src/sha1.c
@@ -420,11 +420,11 @@
420
421 SHA1Init(&ctx);
422 SHA1Update(&ctx, (unsigned const char*)zIn, strlen(zIn));
423 SHA1Final(zResult, &ctx);
424 DigestToBase16(zResult, zDigest);
425 return mprintf("%s", zDigest);
426 }
427
428 /*
429 ** Convert a cleartext password for a specific user into a SHA1 hash.
430 **
@@ -459,11 +459,11 @@
459
460 /* On the first xfer request of a clone, the project-code is not yet
461 ** known. Use the cleartext password, since that is all we have.
462 */
463 if( zProjectId==0 ){
464 return mprintf("%s", zPw);
465 }
466 }
467 zProjCode = zProjectId;
468 }
469 SHA1Update(&ctx, (unsigned char*)zProjCode, strlen(zProjCode));
@@ -471,11 +471,11 @@
471 SHA1Update(&ctx, (unsigned char*)zLogin, strlen(zLogin));
472 SHA1Update(&ctx, (unsigned char*)"/", 1);
473 SHA1Update(&ctx, (unsigned const char*)zPw, strlen(zPw));
474 SHA1Final(zResult, &ctx);
475 DigestToBase16(zResult, zDigest);
476 return mprintf("%s", zDigest);
477 }
478
479 /*
480 ** Implement the shared_secret() SQL function. shared_secret() takes two or
481 ** three arguments; the third argument is optional.
482
--- src/sha1.c
+++ src/sha1.c
@@ -420,11 +420,11 @@
420
421 SHA1Init(&ctx);
422 SHA1Update(&ctx, (unsigned const char*)zIn, strlen(zIn));
423 SHA1Final(zResult, &ctx);
424 DigestToBase16(zResult, zDigest);
425 return fossil_strdup(zDigest);
426 }
427
428 /*
429 ** Convert a cleartext password for a specific user into a SHA1 hash.
430 **
@@ -459,11 +459,11 @@
459
460 /* On the first xfer request of a clone, the project-code is not yet
461 ** known. Use the cleartext password, since that is all we have.
462 */
463 if( zProjectId==0 ){
464 return fossil_strdup(zPw);
465 }
466 }
467 zProjCode = zProjectId;
468 }
469 SHA1Update(&ctx, (unsigned char*)zProjCode, strlen(zProjCode));
@@ -471,11 +471,11 @@
471 SHA1Update(&ctx, (unsigned char*)zLogin, strlen(zLogin));
472 SHA1Update(&ctx, (unsigned char*)"/", 1);
473 SHA1Update(&ctx, (unsigned const char*)zPw, strlen(zPw));
474 SHA1Final(zResult, &ctx);
475 DigestToBase16(zResult, zDigest);
476 return fossil_strdup(zDigest);
477 }
478
479 /*
480 ** Implement the shared_secret() SQL function. shared_secret() takes two or
481 ** three arguments; the third argument is optional.
482
+1 -1
--- src/sha3.c
+++ src/sha3.c
@@ -612,11 +612,11 @@
612612
char zDigest[132];
613613
614614
SHA3Init(&ctx, iSize);
615615
SHA3Update(&ctx, (unsigned const char*)zIn, strlen(zIn));
616616
DigestToBase16(SHA3Final(&ctx), zDigest, iSize/8);
617
- return mprintf("%s", zDigest);
617
+ return fossil_strdup(zDigest);
618618
}
619619
#endif
620620
621621
/*
622622
** COMMAND: sha3sum*
623623
--- src/sha3.c
+++ src/sha3.c
@@ -612,11 +612,11 @@
612 char zDigest[132];
613
614 SHA3Init(&ctx, iSize);
615 SHA3Update(&ctx, (unsigned const char*)zIn, strlen(zIn));
616 DigestToBase16(SHA3Final(&ctx), zDigest, iSize/8);
617 return mprintf("%s", zDigest);
618 }
619 #endif
620
621 /*
622 ** COMMAND: sha3sum*
623
--- src/sha3.c
+++ src/sha3.c
@@ -612,11 +612,11 @@
612 char zDigest[132];
613
614 SHA3Init(&ctx, iSize);
615 SHA3Update(&ctx, (unsigned const char*)zIn, strlen(zIn));
616 DigestToBase16(SHA3Final(&ctx), zDigest, iSize/8);
617 return fossil_strdup(zDigest);
618 }
619 #endif
620
621 /*
622 ** COMMAND: sha3sum*
623
+1 -1
--- src/tag.c
+++ src/tag.c
@@ -219,11 +219,11 @@
219219
}
220220
if( zCol ){
221221
db_multi_exec("UPDATE event SET \"%w\"=%Q WHERE objid=%d",
222222
zCol, zValue, rid);
223223
if( tagid==TAG_COMMENT ){
224
- char *zCopy = mprintf("%s", zValue);
224
+ char *zCopy = fossil_strdup(zValue);
225225
backlink_extract(zCopy, MT_NONE, rid, BKLNK_COMMENT, mtime, 1);
226226
free(zCopy);
227227
}
228228
}
229229
if( tagid==TAG_DATE ){
230230
--- src/tag.c
+++ src/tag.c
@@ -219,11 +219,11 @@
219 }
220 if( zCol ){
221 db_multi_exec("UPDATE event SET \"%w\"=%Q WHERE objid=%d",
222 zCol, zValue, rid);
223 if( tagid==TAG_COMMENT ){
224 char *zCopy = mprintf("%s", zValue);
225 backlink_extract(zCopy, MT_NONE, rid, BKLNK_COMMENT, mtime, 1);
226 free(zCopy);
227 }
228 }
229 if( tagid==TAG_DATE ){
230
--- src/tag.c
+++ src/tag.c
@@ -219,11 +219,11 @@
219 }
220 if( zCol ){
221 db_multi_exec("UPDATE event SET \"%w\"=%Q WHERE objid=%d",
222 zCol, zValue, rid);
223 if( tagid==TAG_COMMENT ){
224 char *zCopy = fossil_strdup(zValue);
225 backlink_extract(zCopy, MT_NONE, rid, BKLNK_COMMENT, mtime, 1);
226 free(zCopy);
227 }
228 }
229 if( tagid==TAG_DATE ){
230
+1 -1
--- src/th_main.c
+++ src/th_main.c
@@ -1432,11 +1432,11 @@
14321432
int *argl
14331433
){
14341434
if( argc!=3 ){
14351435
return Th_WrongNumArgs(interp, "setParameter NAME VALUE");
14361436
}
1437
- cgi_replace_parameter(mprintf("%s", argv[1]), mprintf("%s", argv[2]));
1437
+ cgi_replace_parameter(fossil_strdup(argv[1]), fossil_strdup(argv[2]));
14381438
return TH_OK;
14391439
}
14401440
14411441
/*
14421442
** TH1 command: reinitialize ?FLAGS?
14431443
--- src/th_main.c
+++ src/th_main.c
@@ -1432,11 +1432,11 @@
1432 int *argl
1433 ){
1434 if( argc!=3 ){
1435 return Th_WrongNumArgs(interp, "setParameter NAME VALUE");
1436 }
1437 cgi_replace_parameter(mprintf("%s", argv[1]), mprintf("%s", argv[2]));
1438 return TH_OK;
1439 }
1440
1441 /*
1442 ** TH1 command: reinitialize ?FLAGS?
1443
--- src/th_main.c
+++ src/th_main.c
@@ -1432,11 +1432,11 @@
1432 int *argl
1433 ){
1434 if( argc!=3 ){
1435 return Th_WrongNumArgs(interp, "setParameter NAME VALUE");
1436 }
1437 cgi_replace_parameter(fossil_strdup(argv[1]), fossil_strdup(argv[2]));
1438 return TH_OK;
1439 }
1440
1441 /*
1442 ** TH1 command: reinitialize ?FLAGS?
1443
+2 -2
--- src/timeline.c
+++ src/timeline.c
@@ -3039,11 +3039,11 @@
30393039
"brlist", "List"
30403040
};
30413041
double rDate;
30423042
zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
30433043
if( (!zDate || !zDate[0]) && ( zAfter || zBefore ) ){
3044
- zDate = mprintf("%s", (zAfter ? zAfter : zBefore));
3044
+ zDate = fossil_strdup((zAfter ? zAfter : zBefore));
30453045
}
30463046
if( zDate ){
30473047
rDate = symbolic_name_to_mtime(zDate, 0, 0);
30483048
if( db_int(0,
30493049
"SELECT EXISTS (SELECT 1 FROM event CROSS JOIN blob"
@@ -3055,11 +3055,11 @@
30553055
}
30563056
free(zDate);
30573057
}
30583058
zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/");
30593059
if( (!zDate || !zDate[0]) && ( zAfter || zBefore ) ){
3060
- zDate = mprintf("%s", (zBefore ? zBefore : zAfter));
3060
+ zDate = fossil_strdup((zBefore ? zBefore : zAfter));
30613061
}
30623062
if( zDate ){
30633063
rDate = symbolic_name_to_mtime(zDate, 0, 0);
30643064
if( db_int(0,
30653065
"SELECT EXISTS (SELECT 1 FROM event CROSS JOIN blob"
30663066
--- src/timeline.c
+++ src/timeline.c
@@ -3039,11 +3039,11 @@
3039 "brlist", "List"
3040 };
3041 double rDate;
3042 zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
3043 if( (!zDate || !zDate[0]) && ( zAfter || zBefore ) ){
3044 zDate = mprintf("%s", (zAfter ? zAfter : zBefore));
3045 }
3046 if( zDate ){
3047 rDate = symbolic_name_to_mtime(zDate, 0, 0);
3048 if( db_int(0,
3049 "SELECT EXISTS (SELECT 1 FROM event CROSS JOIN blob"
@@ -3055,11 +3055,11 @@
3055 }
3056 free(zDate);
3057 }
3058 zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/");
3059 if( (!zDate || !zDate[0]) && ( zAfter || zBefore ) ){
3060 zDate = mprintf("%s", (zBefore ? zBefore : zAfter));
3061 }
3062 if( zDate ){
3063 rDate = symbolic_name_to_mtime(zDate, 0, 0);
3064 if( db_int(0,
3065 "SELECT EXISTS (SELECT 1 FROM event CROSS JOIN blob"
3066
--- src/timeline.c
+++ src/timeline.c
@@ -3039,11 +3039,11 @@
3039 "brlist", "List"
3040 };
3041 double rDate;
3042 zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/");
3043 if( (!zDate || !zDate[0]) && ( zAfter || zBefore ) ){
3044 zDate = fossil_strdup((zAfter ? zAfter : zBefore));
3045 }
3046 if( zDate ){
3047 rDate = symbolic_name_to_mtime(zDate, 0, 0);
3048 if( db_int(0,
3049 "SELECT EXISTS (SELECT 1 FROM event CROSS JOIN blob"
@@ -3055,11 +3055,11 @@
3055 }
3056 free(zDate);
3057 }
3058 zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/");
3059 if( (!zDate || !zDate[0]) && ( zAfter || zBefore ) ){
3060 zDate = fossil_strdup((zBefore ? zBefore : zAfter));
3061 }
3062 if( zDate ){
3063 rDate = symbolic_name_to_mtime(zDate, 0, 0);
3064 if( db_int(0,
3065 "SELECT EXISTS (SELECT 1 FROM event CROSS JOIN blob"
3066
+4 -4
--- src/tkt.c
+++ src/tkt.c
@@ -102,11 +102,11 @@
102102
if( strchr(zFieldName,' ')!=0 ) continue;
103103
if( nField%10==0 ){
104104
aField = fossil_realloc(aField, sizeof(aField[0])*(nField+10) );
105105
}
106106
aField[nField].zBsln = 0;
107
- aField[nField].zName = mprintf("%s", zFieldName);
107
+ aField[nField].zName = fossil_strdup(zFieldName);
108108
aField[nField].mUsed = USEDBY_TICKET;
109109
nField++;
110110
}
111111
db_finalize(&q);
112112
if( nBaselines ){
@@ -145,11 +145,11 @@
145145
}
146146
if( nField%10==0 ){
147147
aField = fossil_realloc(aField, sizeof(aField[0])*(nField+10) );
148148
}
149149
aField[nField].zBsln = 0;
150
- aField[nField].zName = mprintf("%s", zFieldName);
150
+ aField[nField].zName = fossil_strdup(zFieldName);
151151
aField[nField].mUsed = USEDBY_TICKETCHNG;
152152
nField++;
153153
}
154154
db_finalize(&q);
155155
qsort(aField, nField, sizeof(aField[0]), nameCmpr);
@@ -210,11 +210,11 @@
210210
zVal = "";
211211
}else if( strncmp(zName, "private_", 8)==0 ){
212212
zVal = zRevealed = db_reveal(zVal);
213213
}
214214
if( (j = fieldId(zName))>=0 ){
215
- aField[j].zValue = mprintf("%s", zVal);
215
+ aField[j].zValue = fossil_strdup(zVal);
216216
}else if( memcmp(zName, "tkt_", 4)==0 && Th_Fetch(zName, &size)==0 ){
217217
/* TICKET table columns that begin with "tkt_" are always safe */
218218
Th_Store(zName, zVal);
219219
}
220220
free(zRevealed);
@@ -1787,11 +1787,11 @@
17871787
if( i==g.argc ){
17881788
fossil_fatal("missing value for '%s'!",zFName);
17891789
}
17901790
zFValue = g.argv[i++];
17911791
if( tktEncoding == tktFossilize ){
1792
- zFValue=mprintf("%s",zFValue);
1792
+ zFValue=fossil_strdup(zFValue);
17931793
defossilize(zFValue);
17941794
}
17951795
append = (zFName[0] == '+');
17961796
if( append ){
17971797
zFName++;
17981798
--- src/tkt.c
+++ src/tkt.c
@@ -102,11 +102,11 @@
102 if( strchr(zFieldName,' ')!=0 ) continue;
103 if( nField%10==0 ){
104 aField = fossil_realloc(aField, sizeof(aField[0])*(nField+10) );
105 }
106 aField[nField].zBsln = 0;
107 aField[nField].zName = mprintf("%s", zFieldName);
108 aField[nField].mUsed = USEDBY_TICKET;
109 nField++;
110 }
111 db_finalize(&q);
112 if( nBaselines ){
@@ -145,11 +145,11 @@
145 }
146 if( nField%10==0 ){
147 aField = fossil_realloc(aField, sizeof(aField[0])*(nField+10) );
148 }
149 aField[nField].zBsln = 0;
150 aField[nField].zName = mprintf("%s", zFieldName);
151 aField[nField].mUsed = USEDBY_TICKETCHNG;
152 nField++;
153 }
154 db_finalize(&q);
155 qsort(aField, nField, sizeof(aField[0]), nameCmpr);
@@ -210,11 +210,11 @@
210 zVal = "";
211 }else if( strncmp(zName, "private_", 8)==0 ){
212 zVal = zRevealed = db_reveal(zVal);
213 }
214 if( (j = fieldId(zName))>=0 ){
215 aField[j].zValue = mprintf("%s", zVal);
216 }else if( memcmp(zName, "tkt_", 4)==0 && Th_Fetch(zName, &size)==0 ){
217 /* TICKET table columns that begin with "tkt_" are always safe */
218 Th_Store(zName, zVal);
219 }
220 free(zRevealed);
@@ -1787,11 +1787,11 @@
1787 if( i==g.argc ){
1788 fossil_fatal("missing value for '%s'!",zFName);
1789 }
1790 zFValue = g.argv[i++];
1791 if( tktEncoding == tktFossilize ){
1792 zFValue=mprintf("%s",zFValue);
1793 defossilize(zFValue);
1794 }
1795 append = (zFName[0] == '+');
1796 if( append ){
1797 zFName++;
1798
--- src/tkt.c
+++ src/tkt.c
@@ -102,11 +102,11 @@
102 if( strchr(zFieldName,' ')!=0 ) continue;
103 if( nField%10==0 ){
104 aField = fossil_realloc(aField, sizeof(aField[0])*(nField+10) );
105 }
106 aField[nField].zBsln = 0;
107 aField[nField].zName = fossil_strdup(zFieldName);
108 aField[nField].mUsed = USEDBY_TICKET;
109 nField++;
110 }
111 db_finalize(&q);
112 if( nBaselines ){
@@ -145,11 +145,11 @@
145 }
146 if( nField%10==0 ){
147 aField = fossil_realloc(aField, sizeof(aField[0])*(nField+10) );
148 }
149 aField[nField].zBsln = 0;
150 aField[nField].zName = fossil_strdup(zFieldName);
151 aField[nField].mUsed = USEDBY_TICKETCHNG;
152 nField++;
153 }
154 db_finalize(&q);
155 qsort(aField, nField, sizeof(aField[0]), nameCmpr);
@@ -210,11 +210,11 @@
210 zVal = "";
211 }else if( strncmp(zName, "private_", 8)==0 ){
212 zVal = zRevealed = db_reveal(zVal);
213 }
214 if( (j = fieldId(zName))>=0 ){
215 aField[j].zValue = fossil_strdup(zVal);
216 }else if( memcmp(zName, "tkt_", 4)==0 && Th_Fetch(zName, &size)==0 ){
217 /* TICKET table columns that begin with "tkt_" are always safe */
218 Th_Store(zName, zVal);
219 }
220 free(zRevealed);
@@ -1787,11 +1787,11 @@
1787 if( i==g.argc ){
1788 fossil_fatal("missing value for '%s'!",zFName);
1789 }
1790 zFValue = g.argv[i++];
1791 if( tktEncoding == tktFossilize ){
1792 zFValue=fossil_strdup(zFValue);
1793 defossilize(zFValue);
1794 }
1795 append = (zFName[0] == '+');
1796 if( append ){
1797 zFName++;
1798
+4 -4
--- src/url.c
+++ src/url.c
@@ -227,11 +227,11 @@
227227
}else{
228228
pUrlData->port = pUrlData->dfltPort;
229229
pUrlData->hostname = pUrlData->name;
230230
}
231231
dehttpize(pUrlData->name);
232
- pUrlData->path = mprintf("%s", &zUrl[i]);
232
+ pUrlData->path = fossil_strdup(&zUrl[i]);
233233
for(i=0; pUrlData->path[i] && pUrlData->path[i]!='?'; i++){}
234234
if( pUrlData->path[i] ){
235235
pUrlData->path[i] = 0;
236236
i++;
237237
}
@@ -275,11 +275,11 @@
275275
pUrlData->path, zExe
276276
);
277277
}
278278
if( pUrlData->isSsh && pUrlData->path[1] ){
279279
char *zOld = pUrlData->path;
280
- pUrlData->path = mprintf("%s", zOld+1);
280
+ pUrlData->path = fossil_strdup(zOld+1);
281281
fossil_free(zOld);
282282
}
283283
free(zLogin);
284284
}else if( strncmp(zUrl, "file:", 5)==0 ){
285285
pUrlData->isFile = 1;
@@ -286,14 +286,14 @@
286286
if( zUrl[5]=='/' && zUrl[6]=='/' ){
287287
i = 7;
288288
}else{
289289
i = 5;
290290
}
291
- zFile = mprintf("%s", &zUrl[i]);
291
+ zFile = fossil_strdup(&zUrl[i]);
292292
}else if( file_isfile(zUrl, ExtFILE) ){
293293
pUrlData->isFile = 1;
294
- zFile = mprintf("%s", zUrl);
294
+ zFile = fossil_strdup(zUrl);
295295
}else if( file_isdir(zUrl, ExtFILE)==1 ){
296296
zFile = mprintf("%s/FOSSIL", zUrl);
297297
if( file_isfile(zFile, ExtFILE) ){
298298
pUrlData->isFile = 1;
299299
}else{
300300
--- src/url.c
+++ src/url.c
@@ -227,11 +227,11 @@
227 }else{
228 pUrlData->port = pUrlData->dfltPort;
229 pUrlData->hostname = pUrlData->name;
230 }
231 dehttpize(pUrlData->name);
232 pUrlData->path = mprintf("%s", &zUrl[i]);
233 for(i=0; pUrlData->path[i] && pUrlData->path[i]!='?'; i++){}
234 if( pUrlData->path[i] ){
235 pUrlData->path[i] = 0;
236 i++;
237 }
@@ -275,11 +275,11 @@
275 pUrlData->path, zExe
276 );
277 }
278 if( pUrlData->isSsh && pUrlData->path[1] ){
279 char *zOld = pUrlData->path;
280 pUrlData->path = mprintf("%s", zOld+1);
281 fossil_free(zOld);
282 }
283 free(zLogin);
284 }else if( strncmp(zUrl, "file:", 5)==0 ){
285 pUrlData->isFile = 1;
@@ -286,14 +286,14 @@
286 if( zUrl[5]=='/' && zUrl[6]=='/' ){
287 i = 7;
288 }else{
289 i = 5;
290 }
291 zFile = mprintf("%s", &zUrl[i]);
292 }else if( file_isfile(zUrl, ExtFILE) ){
293 pUrlData->isFile = 1;
294 zFile = mprintf("%s", zUrl);
295 }else if( file_isdir(zUrl, ExtFILE)==1 ){
296 zFile = mprintf("%s/FOSSIL", zUrl);
297 if( file_isfile(zFile, ExtFILE) ){
298 pUrlData->isFile = 1;
299 }else{
300
--- src/url.c
+++ src/url.c
@@ -227,11 +227,11 @@
227 }else{
228 pUrlData->port = pUrlData->dfltPort;
229 pUrlData->hostname = pUrlData->name;
230 }
231 dehttpize(pUrlData->name);
232 pUrlData->path = fossil_strdup(&zUrl[i]);
233 for(i=0; pUrlData->path[i] && pUrlData->path[i]!='?'; i++){}
234 if( pUrlData->path[i] ){
235 pUrlData->path[i] = 0;
236 i++;
237 }
@@ -275,11 +275,11 @@
275 pUrlData->path, zExe
276 );
277 }
278 if( pUrlData->isSsh && pUrlData->path[1] ){
279 char *zOld = pUrlData->path;
280 pUrlData->path = fossil_strdup(zOld+1);
281 fossil_free(zOld);
282 }
283 free(zLogin);
284 }else if( strncmp(zUrl, "file:", 5)==0 ){
285 pUrlData->isFile = 1;
@@ -286,14 +286,14 @@
286 if( zUrl[5]=='/' && zUrl[6]=='/' ){
287 i = 7;
288 }else{
289 i = 5;
290 }
291 zFile = fossil_strdup(&zUrl[i]);
292 }else if( file_isfile(zUrl, ExtFILE) ){
293 pUrlData->isFile = 1;
294 zFile = fossil_strdup(zUrl);
295 }else if( file_isdir(zUrl, ExtFILE)==1 ){
296 zFile = mprintf("%s/FOSSIL", zUrl);
297 if( file_isfile(zFile, ExtFILE) ){
298 pUrlData->isFile = 1;
299 }else{
300
+1 -1
--- src/user.c
+++ src/user.c
@@ -521,11 +521,11 @@
521521
return 0;
522522
}
523523
uid = db_int(0, "SELECT uid FROM user WHERE login=%Q", zLogin);
524524
if( uid ){
525525
g.userUid = uid;
526
- g.zLogin = mprintf("%s", zLogin);
526
+ g.zLogin = fossil_strdup(zLogin);
527527
return 1;
528528
}
529529
return 0;
530530
}
531531
532532
--- src/user.c
+++ src/user.c
@@ -521,11 +521,11 @@
521 return 0;
522 }
523 uid = db_int(0, "SELECT uid FROM user WHERE login=%Q", zLogin);
524 if( uid ){
525 g.userUid = uid;
526 g.zLogin = mprintf("%s", zLogin);
527 return 1;
528 }
529 return 0;
530 }
531
532
--- src/user.c
+++ src/user.c
@@ -521,11 +521,11 @@
521 return 0;
522 }
523 uid = db_int(0, "SELECT uid FROM user WHERE login=%Q", zLogin);
524 if( uid ){
525 g.userUid = uid;
526 g.zLogin = fossil_strdup(zLogin);
527 return 1;
528 }
529 return 0;
530 }
531
532
+2 -2
--- src/vfile.c
+++ src/vfile.c
@@ -643,11 +643,11 @@
643643
if( pEntry->d_name[0]=='.' ){
644644
if( (scanFlags & SCAN_ALL)==0 ) continue;
645645
if( pEntry->d_name[1]==0 ) continue;
646646
if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
647647
}
648
- zOrigPath = mprintf("%s", blob_str(pPath));
648
+ zOrigPath = fossil_strdup(blob_str(pPath));
649649
zUtf8 = fossil_path_to_utf8(pEntry->d_name);
650650
blob_appendf(pPath, "/%s", zUtf8);
651651
zPath = blob_str(pPath);
652652
if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
653653
glob_match(pIgnore2, &zPath[nPrefix+1]) ){
@@ -657,11 +657,11 @@
657657
? (file_isdir(zPath, eFType)==1) : (pEntry->d_type==DT_DIR) ){
658658
#else
659659
}else if( file_isdir(zPath, eFType)==1 ){
660660
#endif
661661
if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){
662
- char *zSavePath = mprintf("%s", zPath);
662
+ char *zSavePath = fossil_strdup(zPath);
663663
int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1,
664664
pIgnore2, eFType);
665665
db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]);
666666
db_bind_int(&ins, ":count", count);
667667
db_step(&ins);
668668
--- src/vfile.c
+++ src/vfile.c
@@ -643,11 +643,11 @@
643 if( pEntry->d_name[0]=='.' ){
644 if( (scanFlags & SCAN_ALL)==0 ) continue;
645 if( pEntry->d_name[1]==0 ) continue;
646 if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
647 }
648 zOrigPath = mprintf("%s", blob_str(pPath));
649 zUtf8 = fossil_path_to_utf8(pEntry->d_name);
650 blob_appendf(pPath, "/%s", zUtf8);
651 zPath = blob_str(pPath);
652 if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
653 glob_match(pIgnore2, &zPath[nPrefix+1]) ){
@@ -657,11 +657,11 @@
657 ? (file_isdir(zPath, eFType)==1) : (pEntry->d_type==DT_DIR) ){
658 #else
659 }else if( file_isdir(zPath, eFType)==1 ){
660 #endif
661 if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){
662 char *zSavePath = mprintf("%s", zPath);
663 int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1,
664 pIgnore2, eFType);
665 db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]);
666 db_bind_int(&ins, ":count", count);
667 db_step(&ins);
668
--- src/vfile.c
+++ src/vfile.c
@@ -643,11 +643,11 @@
643 if( pEntry->d_name[0]=='.' ){
644 if( (scanFlags & SCAN_ALL)==0 ) continue;
645 if( pEntry->d_name[1]==0 ) continue;
646 if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue;
647 }
648 zOrigPath = fossil_strdup(blob_str(pPath));
649 zUtf8 = fossil_path_to_utf8(pEntry->d_name);
650 blob_appendf(pPath, "/%s", zUtf8);
651 zPath = blob_str(pPath);
652 if( glob_match(pIgnore1, &zPath[nPrefix+1]) ||
653 glob_match(pIgnore2, &zPath[nPrefix+1]) ){
@@ -657,11 +657,11 @@
657 ? (file_isdir(zPath, eFType)==1) : (pEntry->d_type==DT_DIR) ){
658 #else
659 }else if( file_isdir(zPath, eFType)==1 ){
660 #endif
661 if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){
662 char *zSavePath = fossil_strdup(zPath);
663 int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1,
664 pIgnore2, eFType);
665 db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]);
666 db_bind_int(&ins, ":count", count);
667 db_step(&ins);
668
+1 -1
--- src/wiki.c
+++ src/wiki.c
@@ -574,11 +574,11 @@
574574
Blob wiki;
575575
Manifest *pWiki = 0;
576576
const char *zPageName;
577577
const char *zMimetype = 0;
578578
int isPopup = P("popup")!=0;
579
- char *zBody = mprintf("%s","<i>Empty Page</i>");
579
+ char *zBody = fossil_strdup("<i>Empty Page</i>");
580580
int noSubmenu = P("nsm")!=0 || g.isHome;
581581
582582
login_check_credentials();
583583
if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
584584
zPageName = P("name");
585585
--- src/wiki.c
+++ src/wiki.c
@@ -574,11 +574,11 @@
574 Blob wiki;
575 Manifest *pWiki = 0;
576 const char *zPageName;
577 const char *zMimetype = 0;
578 int isPopup = P("popup")!=0;
579 char *zBody = mprintf("%s","<i>Empty Page</i>");
580 int noSubmenu = P("nsm")!=0 || g.isHome;
581
582 login_check_credentials();
583 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
584 zPageName = P("name");
585
--- src/wiki.c
+++ src/wiki.c
@@ -574,11 +574,11 @@
574 Blob wiki;
575 Manifest *pWiki = 0;
576 const char *zPageName;
577 const char *zMimetype = 0;
578 int isPopup = P("popup")!=0;
579 char *zBody = fossil_strdup("<i>Empty Page</i>");
580 int noSubmenu = P("nsm")!=0 || g.isHome;
581
582 login_check_credentials();
583 if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; }
584 zPageName = P("name");
585
+1 -1
--- src/winhttp.c
+++ src/winhttp.c
@@ -1154,11 +1154,11 @@
11541154
"port number must be in the range 1 - 65535.");
11551155
}
11561156
if( !zRepository ){
11571157
db_must_be_within_tree();
11581158
}else if( file_isdir(zRepository, ExtFILE)==1 ){
1159
- g.zRepositoryName = mprintf("%s", zRepository);
1159
+ g.zRepositoryName = fossil_strdup(zRepository);
11601160
file_simplify_name(g.zRepositoryName, -1, 0);
11611161
}else{
11621162
db_open_repository(zRepository);
11631163
}
11641164
db_close(0);
11651165
--- src/winhttp.c
+++ src/winhttp.c
@@ -1154,11 +1154,11 @@
1154 "port number must be in the range 1 - 65535.");
1155 }
1156 if( !zRepository ){
1157 db_must_be_within_tree();
1158 }else if( file_isdir(zRepository, ExtFILE)==1 ){
1159 g.zRepositoryName = mprintf("%s", zRepository);
1160 file_simplify_name(g.zRepositoryName, -1, 0);
1161 }else{
1162 db_open_repository(zRepository);
1163 }
1164 db_close(0);
1165
--- src/winhttp.c
+++ src/winhttp.c
@@ -1154,11 +1154,11 @@
1154 "port number must be in the range 1 - 65535.");
1155 }
1156 if( !zRepository ){
1157 db_must_be_within_tree();
1158 }else if( file_isdir(zRepository, ExtFILE)==1 ){
1159 g.zRepositoryName = fossil_strdup(zRepository);
1160 file_simplify_name(g.zRepositoryName, -1, 0);
1161 }else{
1162 db_open_repository(zRepository);
1163 }
1164 db_close(0);
1165
+1 -1
--- src/zip.c
+++ src/zip.c
@@ -496,11 +496,11 @@
496496
if( fossil_strcmp(zName, azDir[j])==0 ) break;
497497
}
498498
if( j>=nDir ){
499499
nDir++;
500500
azDir = fossil_realloc(azDir, sizeof(azDir[0])*nDir);
501
- azDir[j] = mprintf("%s", zName);
501
+ azDir[j] = fossil_strdup(zName);
502502
zip_add_file(p, zName, 0, 0);
503503
}
504504
zName[i+1] = c;
505505
}
506506
}
507507
--- src/zip.c
+++ src/zip.c
@@ -496,11 +496,11 @@
496 if( fossil_strcmp(zName, azDir[j])==0 ) break;
497 }
498 if( j>=nDir ){
499 nDir++;
500 azDir = fossil_realloc(azDir, sizeof(azDir[0])*nDir);
501 azDir[j] = mprintf("%s", zName);
502 zip_add_file(p, zName, 0, 0);
503 }
504 zName[i+1] = c;
505 }
506 }
507
--- src/zip.c
+++ src/zip.c
@@ -496,11 +496,11 @@
496 if( fossil_strcmp(zName, azDir[j])==0 ) break;
497 }
498 if( j>=nDir ){
499 nDir++;
500 azDir = fossil_realloc(azDir, sizeof(azDir[0])*nDir);
501 azDir[j] = fossil_strdup(zName);
502 zip_add_file(p, zName, 0, 0);
503 }
504 zName[i+1] = c;
505 }
506 }
507

Keyboard Shortcuts

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