Fossil SCM
Minor optimization: replace calls to mprintf("%s", X) with fossil_strdup(X).
Commit
4c3e1728e1b1a9cb8425046aad3f5c753f33abd751a8a365420cf3397ba21ab9
Parent
c6f0d7aecdfd6fb…
35 files changed
+1
-1
+1
-1
+1
-1
+2
-2
+2
-2
+1
-1
+1
-1
+5
-5
+5
-5
+6
-6
+1
-1
+1
-1
+1
-1
+1
-1
+3
-3
+3
-3
+1
-1
+1
-1
+14
-14
+1
-1
+2
-2
+3
-3
+5
-5
+3
-3
+1
-1
+1
-1
+1
-1
+2
-2
+4
-4
+4
-4
+1
-1
+2
-2
+1
-1
+1
-1
+1
-1
~
src/bisect.c
~
src/chat.c
~
src/checkin.c
~
src/clone.c
~
src/comformat.c
~
src/cookies.c
~
src/event.c
~
src/export.c
~
src/file.c
~
src/fileedit.c
~
src/graph.c
~
src/http_socket.c
~
src/http_ssl.c
~
src/http_transport.c
~
src/import.c
~
src/info.c
~
src/json.c
~
src/json_report.c
~
src/main.c
~
src/merge.c
~
src/name.c
~
src/repolist.c
~
src/search.c
~
src/sha1.c
~
src/sha3.c
~
src/tag.c
~
src/th_main.c
~
src/timeline.c
~
src/tkt.c
~
src/url.c
~
src/user.c
~
src/vfile.c
~
src/wiki.c
~
src/winhttp.c
~
src/zip.c
+1
-1
| --- src/bisect.c | ||
| +++ src/bisect.c | ||
| @@ -336,11 +336,11 @@ | ||
| 336 | 336 | } |
| 337 | 337 | zUuid = db_text(0,"SELECT lower(uuid) FROM blob WHERE rid=%d", rid); |
| 338 | 338 | if( blob_size(&link)>0 ) blob_append(&link, "-", 1); |
| 339 | 339 | blob_appendf(&link, "%c%.10s", cPrefix, zUuid); |
| 340 | 340 | } |
| 341 | - zResult = mprintf("%s", blob_str(&link)); | |
| 341 | + zResult = fossil_strdup(blob_str(&link)); | |
| 342 | 342 | blob_reset(&link); |
| 343 | 343 | blob_reset(&log); |
| 344 | 344 | blob_reset(&id); |
| 345 | 345 | return zResult; |
| 346 | 346 | } |
| 347 | 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 = 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 @@ | ||
| 1321 | 1321 | if( zMsg && zMsg[0] ){ |
| 1322 | 1322 | blob_appendf(&up,"\r\nContent-Disposition: form-data; name=\"msg\"\r\n" |
| 1323 | 1323 | "\r\n%s\r\n%s", zMsg, zBoundary); |
| 1324 | 1324 | } |
| 1325 | 1325 | 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)); | |
| 1327 | 1327 | int i; |
| 1328 | 1328 | const char *zMime = mimetype_from_name(zFN); |
| 1329 | 1329 | for(i=0; zFN[i]; i++){ |
| 1330 | 1330 | char c = zFN[i]; |
| 1331 | 1331 | if( fossil_isalnum(c) ) continue; |
| 1332 | 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 = 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 @@ | ||
| 1386 | 1386 | file_relative_name(g.zLocalRoot, &fname, 1); |
| 1387 | 1387 | zFile = db_text(0, "SELECT '%qci-comment-'||hex(randomblob(6))||'.txt'", |
| 1388 | 1388 | blob_str(&fname)); |
| 1389 | 1389 | }else{ |
| 1390 | 1390 | file_tempname(&fname, "ci-comment",0); |
| 1391 | - zFile = mprintf("%s", blob_str(&fname)); | |
| 1391 | + zFile = fossil_strdup(blob_str(&fname)); | |
| 1392 | 1392 | } |
| 1393 | 1393 | blob_reset(&fname); |
| 1394 | 1394 | } |
| 1395 | 1395 | #if defined(_WIN32) |
| 1396 | 1396 | blob_add_cr(pPrompt); |
| 1397 | 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 = 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 @@ | ||
| 348 | 348 | const char *zHttpAuth, /* Credentials in the form "user:password" */ |
| 349 | 349 | int fRemember, /* True to remember credentials for later reuse */ |
| 350 | 350 | const char *zUrl /* URL for which these credentials apply */ |
| 351 | 351 | ){ |
| 352 | 352 | if( zHttpAuth && zHttpAuth[0] ){ |
| 353 | - g.zHttpAuth = mprintf("%s", zHttpAuth); | |
| 353 | + g.zHttpAuth = fossil_strdup(zHttpAuth); | |
| 354 | 354 | } |
| 355 | 355 | if( fRemember ){ |
| 356 | 356 | if( g.zHttpAuth && g.zHttpAuth[0] ){ |
| 357 | 357 | set_httpauth(g.zHttpAuth); |
| 358 | 358 | }else if( zUrl && zUrl[0] ){ |
| @@ -388,11 +388,11 @@ | ||
| 388 | 388 | void clone_ssh_find_options(void){ |
| 389 | 389 | const char *zSshCmd; /* SSH command string */ |
| 390 | 390 | |
| 391 | 391 | zSshCmd = find_option("ssh-command","c",1); |
| 392 | 392 | if( zSshCmd && zSshCmd[0] ){ |
| 393 | - g.zSshCmd = mprintf("%s", zSshCmd); | |
| 393 | + g.zSshCmd = fossil_strdup(zSshCmd); | |
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | /* |
| 398 | 398 | ** Set SSH options discovered in global variables (set from command line |
| 399 | 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 = 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 @@ | ||
| 807 | 807 | verify_all_options(); |
| 808 | 808 | zPrefix = zText = zOrigText = 0; |
| 809 | 809 | if( fromFile ){ |
| 810 | 810 | Blob fileData; |
| 811 | 811 | blob_read_from_file(&fileData, fromFile, ExtFILE); |
| 812 | - zText = mprintf("%s", blob_str(&fileData)); | |
| 812 | + zText = fossil_strdup(blob_str(&fileData)); | |
| 813 | 813 | blob_reset(&fileData); |
| 814 | 814 | } |
| 815 | 815 | if( fromOrig ){ |
| 816 | 816 | Blob fileData; |
| 817 | 817 | blob_read_from_file(&fileData, fromOrig, ExtFILE); |
| 818 | - zOrigText = mprintf("%s", blob_str(&fileData)); | |
| 818 | + zOrigText = fossil_strdup(blob_str(&fileData)); | |
| 819 | 819 | blob_reset(&fileData); |
| 820 | 820 | } |
| 821 | 821 | for(i=2; i<g.argc; i++){ |
| 822 | 822 | if( zText==0 ){ |
| 823 | 823 | zText = g.argv[i]; |
| 824 | 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 = 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 @@ | ||
| 86 | 86 | void cookie_parse(void){ |
| 87 | 87 | char *z; |
| 88 | 88 | if( cookies.bIsInit ) return; |
| 89 | 89 | z = (char*)P(DISPLAY_SETTINGS_COOKIE); |
| 90 | 90 | if( z==0 ) z = ""; |
| 91 | - cookies.zCookieValue = z = mprintf("%s", z); | |
| 91 | + cookies.zCookieValue = z = fossil_strdup(z); | |
| 92 | 92 | cookies.bIsInit = 1; |
| 93 | 93 | while( cookies.nParam<COOKIE_NPARAM ){ |
| 94 | 94 | while( fossil_isspace(z[0]) ) z++; |
| 95 | 95 | if( z[0]==0 ) break; |
| 96 | 96 | cookies.aParam[cookies.nParam].zPName = z; |
| 97 | 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 = 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 @@ | ||
| 382 | 382 | const char *zClr; /* Name of the background color */ |
| 383 | 383 | const char *zMimetype = P("mimetype"); /* Mimetype of zBody */ |
| 384 | 384 | int isNew = 0; |
| 385 | 385 | |
| 386 | 386 | if( zBody ){ |
| 387 | - zBody = mprintf("%s", zBody); | |
| 387 | + zBody = fossil_strdup(zBody); | |
| 388 | 388 | } |
| 389 | 389 | login_check_credentials(); |
| 390 | 390 | zId = P("name"); |
| 391 | 391 | if( zId==0 ){ |
| 392 | 392 | zId = db_text(0, "SELECT lower(hex(randomblob(20)))"); |
| 393 | 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 = 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 @@ | ||
| 58 | 58 | } |
| 59 | 59 | db_static_prepare(&q, "SELECT info FROM user WHERE login=:user"); |
| 60 | 60 | db_bind_text(&q, ":user", zUser); |
| 61 | 61 | if( db_step(&q)!=SQLITE_ROW ){ |
| 62 | 62 | db_reset(&q); |
| 63 | - zName = mprintf("%s", zUser); | |
| 63 | + zName = fossil_strdup(zUser); | |
| 64 | 64 | for(i=j=0; zName[i]; i++){ |
| 65 | 65 | if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){ |
| 66 | 66 | zName[j++] = zName[i]; |
| 67 | 67 | } |
| 68 | 68 | } |
| @@ -102,11 +102,11 @@ | ||
| 102 | 102 | atEmailFirst = i+1; |
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | if( zContact[i]==0 ){ |
| 106 | 106 | /* 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); | |
| 108 | 108 | for(i=j=0; zName[i]; i++){ |
| 109 | 109 | if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){ |
| 110 | 110 | zName[j++] = zName[i]; |
| 111 | 111 | } |
| 112 | 112 | } |
| @@ -149,11 +149,11 @@ | ||
| 149 | 149 | for(j=0; j<i && zContact[j] && zContact[j]==' '; j++){} |
| 150 | 150 | zName = mprintf("%.*s", i-j+1, &zContact[j]); |
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if( zName==NULL ) zName = mprintf("%s", zUser); | |
| 154 | + if( zName==NULL ) zName = fossil_strdup(zUser); | |
| 155 | 155 | for(i=j=0; zName[i]; i++){ |
| 156 | 156 | if( zName[i]!='<' && zName[i]!='>' && zName[i]!='"' ){ |
| 157 | 157 | zName[j++] = zName[i]; |
| 158 | 158 | } |
| 159 | 159 | } |
| @@ -172,11 +172,11 @@ | ||
| 172 | 172 | ** https://git-scm.com/docs/git-check-ref-format |
| 173 | 173 | ** This implementation assumes we are only printing |
| 174 | 174 | ** the branch or tag part of the reference. |
| 175 | 175 | */ |
| 176 | 176 | static void print_ref(const char *zRef){ |
| 177 | - char *zEncoded = mprintf("%s", zRef); | |
| 177 | + char *zEncoded = fossil_strdup(zRef); | |
| 178 | 178 | int i, w; |
| 179 | 179 | if (zEncoded[0]=='@' && zEncoded[1]=='\0'){ |
| 180 | 180 | putchar(REFREPLACEMENT); |
| 181 | 181 | return; |
| 182 | 182 | } |
| @@ -1152,11 +1152,11 @@ | ||
| 1152 | 1152 | TAG_BRANCH, rid |
| 1153 | 1153 | ); |
| 1154 | 1154 | if( fossil_strcmp(zBranch,"trunk")==0 ){ |
| 1155 | 1155 | assert( gitmirror_mainbranch!=0 ); |
| 1156 | 1156 | fossil_free(zBranch); |
| 1157 | - zBranch = mprintf("%s",gitmirror_mainbranch); | |
| 1157 | + zBranch = fossil_strdup(gitmirror_mainbranch); | |
| 1158 | 1158 | }else if( zBranch==0 ){ |
| 1159 | 1159 | zBranch = mprintf("unknown"); |
| 1160 | 1160 | }else{ |
| 1161 | 1161 | gitmirror_sanitize_name(zBranch); |
| 1162 | 1162 | } |
| 1163 | 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 = 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 @@ | ||
| 260 | 260 | int i, nName; |
| 261 | 261 | char *zName, zBuf[1000]; |
| 262 | 262 | |
| 263 | 263 | nName = strlen(zLinkFile); |
| 264 | 264 | if( nName>=(int)sizeof(zBuf) ){ |
| 265 | - zName = mprintf("%s", zLinkFile); | |
| 265 | + zName = fossil_strdup(zLinkFile); | |
| 266 | 266 | }else{ |
| 267 | 267 | zName = zBuf; |
| 268 | 268 | memcpy(zName, zLinkFile, nName+1); |
| 269 | 269 | } |
| 270 | 270 | nName = file_simplify_name(zName, nName, 0); |
| @@ -425,11 +425,11 @@ | ||
| 425 | 425 | */ |
| 426 | 426 | int file_isdir(const char *zFilename, int eFType){ |
| 427 | 427 | int rc; |
| 428 | 428 | char *zFN; |
| 429 | 429 | |
| 430 | - zFN = mprintf("%s", zFilename); | |
| 430 | + zFN = fossil_strdup(zFilename); | |
| 431 | 431 | file_simplify_name(zFN, -1, 0); |
| 432 | 432 | rc = getStat(zFN, eFType); |
| 433 | 433 | if( rc ){ |
| 434 | 434 | rc = 0; /* It does not exist at all. */ |
| 435 | 435 | }else if( S_ISDIR(fx.fileStat.st_mode) ){ |
| @@ -904,11 +904,11 @@ | ||
| 904 | 904 | ){ |
| 905 | 905 | int nName, rc = 0; |
| 906 | 906 | char *zName; |
| 907 | 907 | |
| 908 | 908 | nName = strlen(zFilename); |
| 909 | - zName = mprintf("%s", zFilename); | |
| 909 | + zName = fossil_strdup(zFilename); | |
| 910 | 910 | nName = file_simplify_name(zName, nName, 0); |
| 911 | 911 | while( nName>0 && zName[nName-1]!='/' ){ nName--; } |
| 912 | 912 | if( nName>1 ){ |
| 913 | 913 | zName[nName-1] = 0; |
| 914 | 914 | if( file_isdir(zName, eFType)!=1 ){ |
| @@ -1277,13 +1277,13 @@ | ||
| 1277 | 1277 | const char *zTail; |
| 1278 | 1278 | for(i=2; i<g.argc; i++){ |
| 1279 | 1279 | zTail = file_skip_userhost(g.argv[i]); |
| 1280 | 1280 | if( zTail ){ |
| 1281 | 1281 | fossil_print("... ON REMOTE: %.*s\n", (int)(zTail-g.argv[i]), g.argv[i]); |
| 1282 | - z = mprintf("%s", zTail); | |
| 1282 | + z = fossil_strdup(zTail); | |
| 1283 | 1283 | }else{ |
| 1284 | - z = mprintf("%s", g.argv[i]); | |
| 1284 | + z = fossil_strdup(g.argv[i]); | |
| 1285 | 1285 | } |
| 1286 | 1286 | fossil_print("[%s] -> ", z); |
| 1287 | 1287 | file_simplify_name(z, -1, 0); |
| 1288 | 1288 | fossil_print("[%s]\n", z); |
| 1289 | 1289 | fossil_free(z); |
| 1290 | 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 = 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 @@ | ||
| 825 | 825 | } |
| 826 | 826 | db_begin_transaction(); |
| 827 | 827 | zFilename = g.argv[2]; |
| 828 | 828 | cimi.zFilename = mprintf("%/", zAsFilename ? zAsFilename : zFilename); |
| 829 | 829 | cimi.filePerm = file_perm(zFilename, ExtFILE); |
| 830 | - cimi.zUser = mprintf("%s", zUser ? zUser : login_name()); | |
| 830 | + cimi.zUser = fossil_strdup(zUser ? zUser : login_name()); | |
| 831 | 831 | if(zDate){ |
| 832 | - cimi.zDate = mprintf("%s", zDate); | |
| 832 | + cimi.zDate = fossil_strdup(zDate); | |
| 833 | 833 | } |
| 834 | 834 | if(zRevision==0 || zRevision[0]==0){ |
| 835 | 835 | if(g.localOpen/*check-out*/){ |
| 836 | 836 | zRevision = db_lget("checkout-hash", 0)/*leak*/; |
| 837 | 837 | }else{ |
| @@ -928,11 +928,11 @@ | ||
| 928 | 928 | char * zFileUuid = 0; |
| 929 | 929 | db_prepare(&stmt, "SELECT uuid, perm FROM files_of_checkin " |
| 930 | 930 | "WHERE filename=%Q %s AND checkinID=%d", |
| 931 | 931 | zFilename, filename_collation(), vid); |
| 932 | 932 | if(SQLITE_ROW==db_step(&stmt)){ |
| 933 | - zFileUuid = mprintf("%s",db_column_text(&stmt, 0)); | |
| 933 | + zFileUuid = fossil_strdup(db_column_text(&stmt, 0)); | |
| 934 | 934 | if(pFilePerm){ |
| 935 | 935 | *pFilePerm = mfile_permstr_int(db_column_text(&stmt, 1)); |
| 936 | 936 | } |
| 937 | 937 | } |
| 938 | 938 | db_finalize(&stmt); |
| @@ -1187,11 +1187,11 @@ | ||
| 1187 | 1187 | if(bIsMissingArg){ |
| 1188 | 1188 | *bIsMissingArg = 1; |
| 1189 | 1189 | } |
| 1190 | 1190 | fail((pErr,"Missing required 'filename' parameter.")); |
| 1191 | 1191 | } |
| 1192 | - p->zFilename = mprintf("%s",zFlag); | |
| 1192 | + p->zFilename = fossil_strdup(zFlag); | |
| 1193 | 1193 | |
| 1194 | 1194 | if(0==fileedit_is_editable(p->zFilename)){ |
| 1195 | 1195 | rc = 403; |
| 1196 | 1196 | fail((pErr,"Filename [%h] is disallowed " |
| 1197 | 1197 | "by the [fileedit-glob] repository " |
| @@ -1248,11 +1248,11 @@ | ||
| 1248 | 1248 | if(zFlag!=0 && *zFlag!=0){ |
| 1249 | 1249 | blob_append(&p->comment, zFlag, -1); |
| 1250 | 1250 | } |
| 1251 | 1251 | zFlag = P("comment_mimetype"); |
| 1252 | 1252 | if(zFlag){ |
| 1253 | - p->zCommentMimetype = mprintf("%s",zFlag); | |
| 1253 | + p->zCommentMimetype = fossil_strdup(zFlag); | |
| 1254 | 1254 | zFlag = 0; |
| 1255 | 1255 | } |
| 1256 | 1256 | #define p_int(K) atoi(PD(K,"0")) |
| 1257 | 1257 | if(p_int("dry_run")!=0){ |
| 1258 | 1258 | p->flags |= CIMINI_DRY_RUN; |
| @@ -1284,11 +1284,11 @@ | ||
| 1284 | 1284 | #undef p_int |
| 1285 | 1285 | /* |
| 1286 | 1286 | ** TODO?: date-override date selection field. Maybe use |
| 1287 | 1287 | ** an input[type=datetime-local]. |
| 1288 | 1288 | */ |
| 1289 | - p->zUser = mprintf("%s",g.zLogin); | |
| 1289 | + p->zUser = fossil_strdup(g.zLogin); | |
| 1290 | 1290 | return 0; |
| 1291 | 1291 | end_fail: |
| 1292 | 1292 | #undef fail |
| 1293 | 1293 | fossil_free(zFileUuid); |
| 1294 | 1294 | return rc ? rc : 500; |
| 1295 | 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 = 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 @@ | ||
| 226 | 226 | for(i=0; i<p->nBranch; i++){ |
| 227 | 227 | if( fossil_strcmp(zBranch, p->azBranch[i])==0 ) return p->azBranch[i]; |
| 228 | 228 | } |
| 229 | 229 | p->nBranch++; |
| 230 | 230 | 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); | |
| 232 | 232 | return p->azBranch[p->nBranch-1]; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /* |
| 236 | 236 | ** Add a new row to the graph context. Rows are added from top to bottom. |
| 237 | 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] = 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 |
+1
-1
| --- src/http_socket.c | ||
| +++ src/http_socket.c | ||
| @@ -175,11 +175,11 @@ | ||
| 175 | 175 | 0, 0, NI_NUMERICHOST); |
| 176 | 176 | if( rc ){ |
| 177 | 177 | socket_set_errmsg("getnameinfo() failed: %s", gai_strerror(rc)); |
| 178 | 178 | goto end_socket_open; |
| 179 | 179 | } |
| 180 | - g.zIpAddr = mprintf("%s", zRemote); | |
| 180 | + g.zIpAddr = fossil_strdup(zRemote); | |
| 181 | 181 | break; |
| 182 | 182 | } |
| 183 | 183 | if( p==0 ){ |
| 184 | 184 | socket_set_errmsg("cannot connect to host %s:%d", pUrlData->name, |
| 185 | 185 | pUrlData->port); |
| 186 | 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 = 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 @@ | ||
| 638 | 638 | ** check here for the correct LIBRESSL_VERSION_NUMBER too. For now: disable |
| 639 | 639 | */ |
| 640 | 640 | #if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x10100000L \ |
| 641 | 641 | && !defined(LIBRESSL_VERSION_NUMBER) |
| 642 | 642 | char *ip = BIO_ADDR_hostname_string(BIO_get_conn_address(iBio),1); |
| 643 | - g.zIpAddr = mprintf("%s", ip); | |
| 643 | + g.zIpAddr = fossil_strdup(ip); | |
| 644 | 644 | OPENSSL_free(ip); |
| 645 | 645 | #else |
| 646 | 646 | /* IPv4 only code */ |
| 647 | 647 | const unsigned char *ip; |
| 648 | 648 | ip = (const unsigned char*)BIO_ptr_ctrl(iBio,BIO_C_GET_CONNECT,2); |
| 649 | 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 = 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 |
+1
-1
| --- src/http_transport.c | ||
| +++ src/http_transport.c | ||
| @@ -121,11 +121,11 @@ | ||
| 121 | 121 | */ |
| 122 | 122 | Blob zCmd; /* The SSH command */ |
| 123 | 123 | char *zHost; /* The host name to contact */ |
| 124 | 124 | |
| 125 | 125 | fossil_free(g.zIpAddr); |
| 126 | - g.zIpAddr = mprintf("%s", pUrlData->name); | |
| 126 | + g.zIpAddr = fossil_strdup(pUrlData->name); | |
| 127 | 127 | transport_ssh_command(&zCmd); |
| 128 | 128 | if( pUrlData->port!=pUrlData->dfltPort && pUrlData->port ){ |
| 129 | 129 | blob_appendf(&zCmd, " -p %d", pUrlData->port); |
| 130 | 130 | } |
| 131 | 131 | blob_appendf(&zCmd, " -T --"); /* End of switches */ |
| 132 | 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 = 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 @@ | ||
| 895 | 895 | char *sep; |
| 896 | 896 | if( zLine[0]=='\n' ) break; |
| 897 | 897 | rec->nHeaders += 1; |
| 898 | 898 | rec->aHeaders = fossil_realloc(rec->aHeaders, |
| 899 | 899 | 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); | |
| 901 | 901 | sep = strchr(rec->aHeaders[rec->nHeaders-1].zKey, ':'); |
| 902 | 902 | if( !sep ){ |
| 903 | 903 | trim_newline(zLine); |
| 904 | 904 | fossil_fatal("bad header line: [%s]", zLine); |
| 905 | 905 | } |
| @@ -1426,12 +1426,12 @@ | ||
| 1426 | 1426 | fossil_free(gsvn.zDate); |
| 1427 | 1427 | bag_clear(&gsvn.newBranches); |
| 1428 | 1428 | } |
| 1429 | 1429 | /* start new revision */ |
| 1430 | 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")); | |
| 1431 | + gsvn.zUser = fossil_strdup(svn_find_prop(rec, "svn:author")); | |
| 1432 | + gsvn.zComment = fossil_strdup(svn_find_prop(rec, "svn:log")); | |
| 1433 | 1433 | zDate = svn_find_prop(rec, "svn:date"); |
| 1434 | 1434 | if( zDate ){ |
| 1435 | 1435 | gsvn.zDate = date_in_standard_format(zDate); |
| 1436 | 1436 | }else{ |
| 1437 | 1437 | gsvn.zDate = date_in_standard_format("now"); |
| 1438 | 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 = 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 @@ | ||
| 2886 | 2886 | style_set_current_page("doc/%t/%T", zCI, zName); |
| 2887 | 2887 | }else if( zCIUuid && zCIUuid[0] ){ |
| 2888 | 2888 | zHeader = mprintf("%s at [%S]", file_tail(zName), zCIUuid); |
| 2889 | 2889 | style_set_current_page("doc/%S/%T", zCIUuid, zName); |
| 2890 | 2890 | }else{ |
| 2891 | - zHeader = mprintf("%s", file_tail(zName)); | |
| 2891 | + zHeader = fossil_strdup(file_tail(zName)); | |
| 2892 | 2892 | style_set_current_page("doc/tip/%T", zName); |
| 2893 | 2893 | } |
| 2894 | 2894 | }else if( descOnly ){ |
| 2895 | 2895 | zHeader = mprintf("Artifact Description [%S]", zUuid); |
| 2896 | 2896 | }else{ |
| @@ -4240,11 +4240,11 @@ | ||
| 4240 | 4240 | descr->isDirty = -1; |
| 4241 | 4241 | return (rid-1); |
| 4242 | 4242 | } |
| 4243 | 4243 | |
| 4244 | 4244 | zUuid = rid_to_uuid(rid); |
| 4245 | - descr->zCommitHash = mprintf("%s", zUuid); | |
| 4245 | + descr->zCommitHash = fossil_strdup(zUuid); | |
| 4246 | 4246 | descr->isDirty = unsaved_changes(0); |
| 4247 | 4247 | |
| 4248 | 4248 | db_multi_exec( |
| 4249 | 4249 | "DROP TABLE IF EXISTS temp.singletonTag;" |
| 4250 | 4250 | "CREATE TEMP TABLE singletonTag(" |
| @@ -4289,11 +4289,11 @@ | ||
| 4289 | 4289 | rid, rid |
| 4290 | 4290 | ); |
| 4291 | 4291 | |
| 4292 | 4292 | if( db_step(&q)==SQLITE_ROW ){ |
| 4293 | 4293 | const char *lastTag = db_column_text(&q, 0); |
| 4294 | - descr->zRelTagname = mprintf("%s", lastTag); | |
| 4294 | + descr->zRelTagname = fossil_strdup(lastTag); | |
| 4295 | 4295 | descr->nCommitsSince = db_column_int(&q, 1); |
| 4296 | 4296 | nRet = 0; |
| 4297 | 4297 | }else{ |
| 4298 | 4298 | /* no ancestor commit with a fitting singleton tag found */ |
| 4299 | 4299 | descr->zRelTagname = mprintf(""); |
| 4300 | 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 = 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 @@ | ||
| 1643 | 1643 | int json_set_err( int code, char const * fmt, ... ){ |
| 1644 | 1644 | assert( (code>=1000) && (code<=9999) ); |
| 1645 | 1645 | fossil_free(g.zErrMsg); |
| 1646 | 1646 | g.json.resultCode = code; |
| 1647 | 1647 | if(!fmt || !*fmt){ |
| 1648 | - g.zErrMsg = mprintf("%s", json_err_cstr(code)); | |
| 1648 | + g.zErrMsg = fossil_strdup(json_err_cstr(code)); | |
| 1649 | 1649 | }else{ |
| 1650 | 1650 | va_list vargs; |
| 1651 | 1651 | char * msg; |
| 1652 | 1652 | va_start(vargs,fmt); |
| 1653 | 1653 | msg = vmprintf(fmt, vargs); |
| 1654 | 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 = 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 |
+1
-1
| --- src/json_report.c | ||
| +++ src/json_report.c | ||
| @@ -202,11 +202,11 @@ | ||
| 202 | 202 | limit = json_find_option_int("limit",NULL,"n",-1); |
| 203 | 203 | |
| 204 | 204 | |
| 205 | 205 | /* Copy over report's SQL...*/ |
| 206 | 206 | 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)); | |
| 208 | 208 | db_finalize(&q); |
| 209 | 209 | db_prepare(&q, "%s", blob_sql_text(&sql)); |
| 210 | 210 | |
| 211 | 211 | /** Build the response... */ |
| 212 | 212 | pay = cson_new_object(); |
| 213 | 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 = 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 @@ | ||
| 1139 | 1139 | */ |
| 1140 | 1140 | const char *find_repository_option(){ |
| 1141 | 1141 | const char *zRepository = find_option("repository", "R", 1); |
| 1142 | 1142 | if( zRepository ){ |
| 1143 | 1143 | if( g.zRepositoryOption ) fossil_free(g.zRepositoryOption); |
| 1144 | - g.zRepositoryOption = mprintf("%s", zRepository); | |
| 1144 | + g.zRepositoryOption = fossil_strdup(zRepository); | |
| 1145 | 1145 | } |
| 1146 | 1146 | return g.zRepositoryOption; |
| 1147 | 1147 | } |
| 1148 | 1148 | |
| 1149 | 1149 | /* |
| @@ -1385,20 +1385,20 @@ | ||
| 1385 | 1385 | const char *zCur; |
| 1386 | 1386 | |
| 1387 | 1387 | if( g.zBaseURL!=0 ) return; |
| 1388 | 1388 | if( zAltBase ){ |
| 1389 | 1389 | int i, n, c; |
| 1390 | - g.zTop = g.zBaseURL = mprintf("%s", zAltBase); | |
| 1390 | + g.zTop = g.zBaseURL = fossil_strdup(zAltBase); | |
| 1391 | 1391 | i = (int)strlen(g.zBaseURL); |
| 1392 | 1392 | while( i>3 && g.zBaseURL[i-1]=='/' ){ i--; } |
| 1393 | 1393 | g.zBaseURL[i] = 0; |
| 1394 | 1394 | if( strncmp(g.zTop, "http://", 7)==0 ){ |
| 1395 | 1395 | /* it is HTTP, replace prefix with HTTPS. */ |
| 1396 | 1396 | g.zHttpsURL = mprintf("https://%s", &g.zTop[7]); |
| 1397 | 1397 | }else if( strncmp(g.zTop, "https://", 8)==0 ){ |
| 1398 | 1398 | /* it is already HTTPS, use it. */ |
| 1399 | - g.zHttpsURL = mprintf("%s", g.zTop); | |
| 1399 | + g.zHttpsURL = fossil_strdup(g.zTop); | |
| 1400 | 1400 | }else{ |
| 1401 | 1401 | fossil_fatal("argument to --baseurl should be 'http://host/path'" |
| 1402 | 1402 | " or 'https://host/path'"); |
| 1403 | 1403 | } |
| 1404 | 1404 | for(i=n=0; (c = g.zTop[i])!=0; i++){ |
| @@ -2071,11 +2071,11 @@ | ||
| 2071 | 2071 | cgi_redirectf("%R/ckout"); |
| 2072 | 2072 | }else{ |
| 2073 | 2073 | fossil_redirect_home() /*does not return*/; |
| 2074 | 2074 | } |
| 2075 | 2075 | }else{ |
| 2076 | - zPath = mprintf("%s", zPathInfo); | |
| 2076 | + zPath = fossil_strdup(zPathInfo); | |
| 2077 | 2077 | } |
| 2078 | 2078 | |
| 2079 | 2079 | /* Make g.zPath point to the first element of the path. Make |
| 2080 | 2080 | ** g.zExtra point to everything past that point. |
| 2081 | 2081 | */ |
| @@ -2482,21 +2482,21 @@ | ||
| 2482 | 2482 | ** If repository: is omitted, then terms of the PATH_INFO cgi parameter |
| 2483 | 2483 | ** are appended to DIRECTORY looking for a repository (whose name ends |
| 2484 | 2484 | ** in ".fossil") or a file in "files:". |
| 2485 | 2485 | */ |
| 2486 | 2486 | db_close(1); |
| 2487 | - g.zRepositoryName = mprintf("%s", blob_str(&value)); | |
| 2487 | + g.zRepositoryName = fossil_strdup(blob_str(&value)); | |
| 2488 | 2488 | blob_reset(&value); |
| 2489 | 2489 | continue; |
| 2490 | 2490 | } |
| 2491 | 2491 | if( blob_eq(&key, "notfound:") && blob_token(&line, &value) ){ |
| 2492 | 2492 | /* notfound: URL |
| 2493 | 2493 | ** |
| 2494 | 2494 | ** If using directory: and no suitable repository or file is found, |
| 2495 | 2495 | ** then redirect to URL. |
| 2496 | 2496 | */ |
| 2497 | - zNotFound = mprintf("%s", blob_str(&value)); | |
| 2497 | + zNotFound = fossil_strdup(blob_str(&value)); | |
| 2498 | 2498 | blob_reset(&value); |
| 2499 | 2499 | continue; |
| 2500 | 2500 | } |
| 2501 | 2501 | if( blob_eq(&key, "localauth") ){ |
| 2502 | 2502 | /* localauth |
| @@ -2536,12 +2536,12 @@ | ||
| 2536 | 2536 | && blob_token(&line, &value2) ){ |
| 2537 | 2537 | /* See the header comment on the redirect_web_page() function |
| 2538 | 2538 | ** above for details. */ |
| 2539 | 2539 | nRedirect++; |
| 2540 | 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)); | |
| 2541 | + azRedirect[nRedirect*2-2] = fossil_strdup(blob_str(&value)); | |
| 2542 | + azRedirect[nRedirect*2-1] = fossil_strdup(blob_str(&value2)); | |
| 2543 | 2543 | blob_reset(&value); |
| 2544 | 2544 | blob_reset(&value2); |
| 2545 | 2545 | continue; |
| 2546 | 2546 | } |
| 2547 | 2547 | if( blob_eq(&key, "files:") && blob_token(&line, &value) ){ |
| @@ -2580,20 +2580,20 @@ | ||
| 2580 | 2580 | /* errorlog: FILENAME |
| 2581 | 2581 | ** |
| 2582 | 2582 | ** Causes messages from warnings, errors, and panics to be appended |
| 2583 | 2583 | ** to FILENAME. |
| 2584 | 2584 | */ |
| 2585 | - g.zErrlog = mprintf("%s", blob_str(&value)); | |
| 2585 | + g.zErrlog = fossil_strdup(blob_str(&value)); | |
| 2586 | 2586 | blob_reset(&value); |
| 2587 | 2587 | continue; |
| 2588 | 2588 | } |
| 2589 | 2589 | if( blob_eq(&key, "extroot:") && blob_token(&line, &value) ){ |
| 2590 | 2590 | /* extroot: DIRECTORY |
| 2591 | 2591 | ** |
| 2592 | 2592 | ** Enables the /ext webpage to use sub-cgi rooted at DIRECTORY |
| 2593 | 2593 | */ |
| 2594 | - g.zExtRoot = mprintf("%s", blob_str(&value)); | |
| 2594 | + g.zExtRoot = fossil_strdup(blob_str(&value)); | |
| 2595 | 2595 | blob_reset(&value); |
| 2596 | 2596 | continue; |
| 2597 | 2597 | } |
| 2598 | 2598 | if( blob_eq(&key, "timeout:") && blob_token(&line, &value) ){ |
| 2599 | 2599 | /* timeout: SECONDS |
| @@ -2650,11 +2650,11 @@ | ||
| 2650 | 2650 | ** |
| 2651 | 2651 | ** Use the contents of FILENAME as the value of the site's |
| 2652 | 2652 | ** "mainmenu" setting, overriding the contents (for this |
| 2653 | 2653 | ** request) of the db-side setting or the hard-coded default. |
| 2654 | 2654 | */ |
| 2655 | - g.zMainMenuFile = mprintf("%s", blob_str(&value)); | |
| 2655 | + g.zMainMenuFile = fossil_strdup(blob_str(&value)); | |
| 2656 | 2656 | blob_reset(&value); |
| 2657 | 2657 | continue; |
| 2658 | 2658 | } |
| 2659 | 2659 | if( blob_eq(&key, "cgi-debug:") && blob_token(&line, &value) ){ |
| 2660 | 2660 | /* cgi-debug: FILENAME |
| @@ -2707,11 +2707,11 @@ | ||
| 2707 | 2707 | db_must_be_within_tree(); |
| 2708 | 2708 | }else{ |
| 2709 | 2709 | const char *zRepo = g.argv[arg]; |
| 2710 | 2710 | int isDir = file_isdir(zRepo, ExtFILE); |
| 2711 | 2711 | if( isDir==1 ){ |
| 2712 | - g.zRepositoryName = mprintf("%s", zRepo); | |
| 2712 | + g.zRepositoryName = fossil_strdup(zRepo); | |
| 2713 | 2713 | file_simplify_name(g.zRepositoryName, -1, 0); |
| 2714 | 2714 | }else{ |
| 2715 | 2715 | if( isDir==0 && fCreate ){ |
| 2716 | 2716 | const char *zPassword; |
| 2717 | 2717 | db_create_repository(zRepo); |
| @@ -2919,11 +2919,11 @@ | ||
| 2919 | 2919 | ** the argument being URL encoded, to avoid wildcard expansion in the |
| 2920 | 2920 | ** shell. This option is for internal use and is undocumented. |
| 2921 | 2921 | */ |
| 2922 | 2922 | zFileGlob = find_option("files-urlenc",0,1); |
| 2923 | 2923 | if( zFileGlob ){ |
| 2924 | - char *z = mprintf("%s", zFileGlob); | |
| 2924 | + char *z = fossil_strdup(zFileGlob); | |
| 2925 | 2925 | dehttpize(z); |
| 2926 | 2926 | zFileGlob = z; |
| 2927 | 2927 | }else{ |
| 2928 | 2928 | zFileGlob = find_option("files",0,1); |
| 2929 | 2929 | } |
| @@ -3329,11 +3329,11 @@ | ||
| 3329 | 3329 | g.zExtRoot = find_option("extroot",0,1); |
| 3330 | 3330 | zJsMode = find_option("jsmode",0,1); |
| 3331 | 3331 | builtin_set_js_delivery_mode(zJsMode,0); |
| 3332 | 3332 | zFileGlob = find_option("files-urlenc",0,1); |
| 3333 | 3333 | if( zFileGlob ){ |
| 3334 | - char *z = mprintf("%s", zFileGlob); | |
| 3334 | + char *z = fossil_strdup(zFileGlob); | |
| 3335 | 3335 | dehttpize(z); |
| 3336 | 3336 | zFileGlob = z; |
| 3337 | 3337 | }else{ |
| 3338 | 3338 | zFileGlob = find_option("files",0,1); |
| 3339 | 3339 | } |
| 3340 | 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 = 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 @@ | ||
| 481 | 481 | const char *zTagList = db_column_text(&q, 4); |
| 482 | 482 | char *zCom; |
| 483 | 483 | if( zTagList && zTagList[0] ){ |
| 484 | 484 | zCom = mprintf("%s (%s)", db_column_text(&q, 2), zTagList); |
| 485 | 485 | }else{ |
| 486 | - zCom = mprintf("%s", db_column_text(&q,2)); | |
| 486 | + zCom = fossil_strdup(db_column_text(&q,2)); | |
| 487 | 487 | } |
| 488 | 488 | fossil_print("%-*s [%S] by %s on %s\n%*s", |
| 489 | 489 | indent-1, zLabel, |
| 490 | 490 | db_column_text(&q, 3), |
| 491 | 491 | db_column_text(&q, 1), |
| 492 | 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 = 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 @@ | ||
| 581 | 581 | nTag = strlen(zTag); |
| 582 | 582 | for(i=0; i<nTag-8 && zTag[i]!=':'; i++){} |
| 583 | 583 | if( zTag[i]==':' |
| 584 | 584 | && (fossil_isdate(&zTag[i+1]) || fossil_expand_datetime(&zTag[i+1],0,0)!=0) |
| 585 | 585 | ){ |
| 586 | - char *zDate = mprintf("%s", &zTag[i+1]); | |
| 586 | + char *zDate = fossil_strdup(&zTag[i+1]); | |
| 587 | 587 | char *zTagBase = mprintf("%.*s", i, zTag); |
| 588 | 588 | char *zXDate; |
| 589 | 589 | int nDate = strlen(zDate); |
| 590 | 590 | if( sqlite3_strnicmp(&zDate[nDate-3],"utc",3)==0 ){ |
| 591 | 591 | zDate[nDate-3] = 'z'; |
| @@ -986,11 +986,11 @@ | ||
| 986 | 986 | } |
| 987 | 987 | style_header("Ambiguous Artifact ID"); |
| 988 | 988 | @ <p>The artifact hash prefix <b>%h(zName)</b> is ambiguous and might |
| 989 | 989 | @ mean any of the following: |
| 990 | 990 | @ <ol> |
| 991 | - z = mprintf("%s", zName); | |
| 991 | + z = fossil_strdup(zName); | |
| 992 | 992 | canonical16(z, strlen(z)); |
| 993 | 993 | db_prepare(&q, "SELECT uuid, rid FROM blob WHERE uuid GLOB '%q*'", z); |
| 994 | 994 | while( db_step(&q)==SQLITE_ROW ){ |
| 995 | 995 | const char *zUuid = db_column_text(&q, 0); |
| 996 | 996 | int rid = db_column_int(&q, 1); |
| 997 | 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 = 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 @@ | ||
| 247 | 247 | if( zName[0]=='/' |
| 248 | 248 | #ifdef _WIN32 |
| 249 | 249 | || sqlite3_strglob("[a-zA-Z]:/*", zName)==0 |
| 250 | 250 | #endif |
| 251 | 251 | ){ |
| 252 | - zFull = mprintf("%s", zName); | |
| 252 | + zFull = fossil_strdup(zName); | |
| 253 | 253 | }else if ( allRepo ){ |
| 254 | 254 | zFull = mprintf("/%s", zName); |
| 255 | 255 | }else{ |
| 256 | 256 | zFull = mprintf("%s/%s", g.zRepositoryName, zName); |
| 257 | 257 | } |
| 258 | 258 | x.zRepoName = zFull; |
| 259 | 259 | remote_repo_info(&x); |
| 260 | 260 | if( x.isRepolistSkin ){ |
| 261 | 261 | 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); | |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | fossil_free(zFull); |
| 267 | 267 | if( !x.isValid |
| 268 | 268 | #if USE_SEE |
| 269 | 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 = 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 @@ | ||
| 130 | 130 | search_end(p); |
| 131 | 131 | }else{ |
| 132 | 132 | p = fossil_malloc(sizeof(*p)); |
| 133 | 133 | memset(p, 0, sizeof(*p)); |
| 134 | 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); | |
| 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 | 139 | p->fSrchFlg = fSrchFlg; |
| 140 | 140 | blob_init(&p->snip, 0, 0); |
| 141 | 141 | while( *z && p->nTerm<SEARCH_MAX_TERM ){ |
| 142 | 142 | while( *z && !ISALNUM(*z) ){ z++; } |
| 143 | 143 | if( *z==0 ) break; |
| @@ -1076,11 +1076,11 @@ | ||
| 1076 | 1076 | ** causing errors in FTS5 searches with inputs which contain AND, OR, |
| 1077 | 1077 | ** and symbols like #. The caller is responsible for passing the |
| 1078 | 1078 | ** result to fossil_free(). |
| 1079 | 1079 | */ |
| 1080 | 1080 | char *search_simplify_pattern(const char * zPattern){ |
| 1081 | - char *zPat = mprintf("%s",zPattern); | |
| 1081 | + char *zPat = fossil_strdup(zPattern); | |
| 1082 | 1082 | int i; |
| 1083 | 1083 | for(i=0; zPat[i]; i++){ |
| 1084 | 1084 | if( (zPat[i]&0x80)==0 && !fossil_isalnum(zPat[i]) ) zPat[i] = ' '; |
| 1085 | 1085 | if( fossil_isupper(zPat[i]) ) zPat[i] = fossil_tolower(zPat[i]); |
| 1086 | 1086 | } |
| 1087 | 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 = 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 @@ | ||
| 420 | 420 | |
| 421 | 421 | SHA1Init(&ctx); |
| 422 | 422 | SHA1Update(&ctx, (unsigned const char*)zIn, strlen(zIn)); |
| 423 | 423 | SHA1Final(zResult, &ctx); |
| 424 | 424 | DigestToBase16(zResult, zDigest); |
| 425 | - return mprintf("%s", zDigest); | |
| 425 | + return fossil_strdup(zDigest); | |
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | /* |
| 429 | 429 | ** Convert a cleartext password for a specific user into a SHA1 hash. |
| 430 | 430 | ** |
| @@ -459,11 +459,11 @@ | ||
| 459 | 459 | |
| 460 | 460 | /* On the first xfer request of a clone, the project-code is not yet |
| 461 | 461 | ** known. Use the cleartext password, since that is all we have. |
| 462 | 462 | */ |
| 463 | 463 | if( zProjectId==0 ){ |
| 464 | - return mprintf("%s", zPw); | |
| 464 | + return fossil_strdup(zPw); | |
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | zProjCode = zProjectId; |
| 468 | 468 | } |
| 469 | 469 | SHA1Update(&ctx, (unsigned char*)zProjCode, strlen(zProjCode)); |
| @@ -471,11 +471,11 @@ | ||
| 471 | 471 | SHA1Update(&ctx, (unsigned char*)zLogin, strlen(zLogin)); |
| 472 | 472 | SHA1Update(&ctx, (unsigned char*)"/", 1); |
| 473 | 473 | SHA1Update(&ctx, (unsigned const char*)zPw, strlen(zPw)); |
| 474 | 474 | SHA1Final(zResult, &ctx); |
| 475 | 475 | DigestToBase16(zResult, zDigest); |
| 476 | - return mprintf("%s", zDigest); | |
| 476 | + return fossil_strdup(zDigest); | |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /* |
| 480 | 480 | ** Implement the shared_secret() SQL function. shared_secret() takes two or |
| 481 | 481 | ** three arguments; the third argument is optional. |
| 482 | 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 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 @@ | ||
| 612 | 612 | char zDigest[132]; |
| 613 | 613 | |
| 614 | 614 | SHA3Init(&ctx, iSize); |
| 615 | 615 | SHA3Update(&ctx, (unsigned const char*)zIn, strlen(zIn)); |
| 616 | 616 | DigestToBase16(SHA3Final(&ctx), zDigest, iSize/8); |
| 617 | - return mprintf("%s", zDigest); | |
| 617 | + return fossil_strdup(zDigest); | |
| 618 | 618 | } |
| 619 | 619 | #endif |
| 620 | 620 | |
| 621 | 621 | /* |
| 622 | 622 | ** COMMAND: sha3sum* |
| 623 | 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 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 @@ | ||
| 219 | 219 | } |
| 220 | 220 | if( zCol ){ |
| 221 | 221 | db_multi_exec("UPDATE event SET \"%w\"=%Q WHERE objid=%d", |
| 222 | 222 | zCol, zValue, rid); |
| 223 | 223 | if( tagid==TAG_COMMENT ){ |
| 224 | - char *zCopy = mprintf("%s", zValue); | |
| 224 | + char *zCopy = fossil_strdup(zValue); | |
| 225 | 225 | backlink_extract(zCopy, MT_NONE, rid, BKLNK_COMMENT, mtime, 1); |
| 226 | 226 | free(zCopy); |
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | if( tagid==TAG_DATE ){ |
| 230 | 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 = 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 @@ | ||
| 1432 | 1432 | int *argl |
| 1433 | 1433 | ){ |
| 1434 | 1434 | if( argc!=3 ){ |
| 1435 | 1435 | return Th_WrongNumArgs(interp, "setParameter NAME VALUE"); |
| 1436 | 1436 | } |
| 1437 | - cgi_replace_parameter(mprintf("%s", argv[1]), mprintf("%s", argv[2])); | |
| 1437 | + cgi_replace_parameter(fossil_strdup(argv[1]), fossil_strdup(argv[2])); | |
| 1438 | 1438 | return TH_OK; |
| 1439 | 1439 | } |
| 1440 | 1440 | |
| 1441 | 1441 | /* |
| 1442 | 1442 | ** TH1 command: reinitialize ?FLAGS? |
| 1443 | 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(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 @@ | ||
| 3039 | 3039 | "brlist", "List" |
| 3040 | 3040 | }; |
| 3041 | 3041 | double rDate; |
| 3042 | 3042 | zDate = db_text(0, "SELECT min(timestamp) FROM timeline /*scan*/"); |
| 3043 | 3043 | if( (!zDate || !zDate[0]) && ( zAfter || zBefore ) ){ |
| 3044 | - zDate = mprintf("%s", (zAfter ? zAfter : zBefore)); | |
| 3044 | + zDate = fossil_strdup((zAfter ? zAfter : zBefore)); | |
| 3045 | 3045 | } |
| 3046 | 3046 | if( zDate ){ |
| 3047 | 3047 | rDate = symbolic_name_to_mtime(zDate, 0, 0); |
| 3048 | 3048 | if( db_int(0, |
| 3049 | 3049 | "SELECT EXISTS (SELECT 1 FROM event CROSS JOIN blob" |
| @@ -3055,11 +3055,11 @@ | ||
| 3055 | 3055 | } |
| 3056 | 3056 | free(zDate); |
| 3057 | 3057 | } |
| 3058 | 3058 | zDate = db_text(0, "SELECT max(timestamp) FROM timeline /*scan*/"); |
| 3059 | 3059 | if( (!zDate || !zDate[0]) && ( zAfter || zBefore ) ){ |
| 3060 | - zDate = mprintf("%s", (zBefore ? zBefore : zAfter)); | |
| 3060 | + zDate = fossil_strdup((zBefore ? zBefore : zAfter)); | |
| 3061 | 3061 | } |
| 3062 | 3062 | if( zDate ){ |
| 3063 | 3063 | rDate = symbolic_name_to_mtime(zDate, 0, 0); |
| 3064 | 3064 | if( db_int(0, |
| 3065 | 3065 | "SELECT EXISTS (SELECT 1 FROM event CROSS JOIN blob" |
| 3066 | 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 = 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 @@ | ||
| 102 | 102 | if( strchr(zFieldName,' ')!=0 ) continue; |
| 103 | 103 | if( nField%10==0 ){ |
| 104 | 104 | aField = fossil_realloc(aField, sizeof(aField[0])*(nField+10) ); |
| 105 | 105 | } |
| 106 | 106 | aField[nField].zBsln = 0; |
| 107 | - aField[nField].zName = mprintf("%s", zFieldName); | |
| 107 | + aField[nField].zName = fossil_strdup(zFieldName); | |
| 108 | 108 | aField[nField].mUsed = USEDBY_TICKET; |
| 109 | 109 | nField++; |
| 110 | 110 | } |
| 111 | 111 | db_finalize(&q); |
| 112 | 112 | if( nBaselines ){ |
| @@ -145,11 +145,11 @@ | ||
| 145 | 145 | } |
| 146 | 146 | if( nField%10==0 ){ |
| 147 | 147 | aField = fossil_realloc(aField, sizeof(aField[0])*(nField+10) ); |
| 148 | 148 | } |
| 149 | 149 | aField[nField].zBsln = 0; |
| 150 | - aField[nField].zName = mprintf("%s", zFieldName); | |
| 150 | + aField[nField].zName = fossil_strdup(zFieldName); | |
| 151 | 151 | aField[nField].mUsed = USEDBY_TICKETCHNG; |
| 152 | 152 | nField++; |
| 153 | 153 | } |
| 154 | 154 | db_finalize(&q); |
| 155 | 155 | qsort(aField, nField, sizeof(aField[0]), nameCmpr); |
| @@ -210,11 +210,11 @@ | ||
| 210 | 210 | zVal = ""; |
| 211 | 211 | }else if( strncmp(zName, "private_", 8)==0 ){ |
| 212 | 212 | zVal = zRevealed = db_reveal(zVal); |
| 213 | 213 | } |
| 214 | 214 | if( (j = fieldId(zName))>=0 ){ |
| 215 | - aField[j].zValue = mprintf("%s", zVal); | |
| 215 | + aField[j].zValue = fossil_strdup(zVal); | |
| 216 | 216 | }else if( memcmp(zName, "tkt_", 4)==0 && Th_Fetch(zName, &size)==0 ){ |
| 217 | 217 | /* TICKET table columns that begin with "tkt_" are always safe */ |
| 218 | 218 | Th_Store(zName, zVal); |
| 219 | 219 | } |
| 220 | 220 | free(zRevealed); |
| @@ -1787,11 +1787,11 @@ | ||
| 1787 | 1787 | if( i==g.argc ){ |
| 1788 | 1788 | fossil_fatal("missing value for '%s'!",zFName); |
| 1789 | 1789 | } |
| 1790 | 1790 | zFValue = g.argv[i++]; |
| 1791 | 1791 | if( tktEncoding == tktFossilize ){ |
| 1792 | - zFValue=mprintf("%s",zFValue); | |
| 1792 | + zFValue=fossil_strdup(zFValue); | |
| 1793 | 1793 | defossilize(zFValue); |
| 1794 | 1794 | } |
| 1795 | 1795 | append = (zFName[0] == '+'); |
| 1796 | 1796 | if( append ){ |
| 1797 | 1797 | zFName++; |
| 1798 | 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 = 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 @@ | ||
| 227 | 227 | }else{ |
| 228 | 228 | pUrlData->port = pUrlData->dfltPort; |
| 229 | 229 | pUrlData->hostname = pUrlData->name; |
| 230 | 230 | } |
| 231 | 231 | dehttpize(pUrlData->name); |
| 232 | - pUrlData->path = mprintf("%s", &zUrl[i]); | |
| 232 | + pUrlData->path = fossil_strdup(&zUrl[i]); | |
| 233 | 233 | for(i=0; pUrlData->path[i] && pUrlData->path[i]!='?'; i++){} |
| 234 | 234 | if( pUrlData->path[i] ){ |
| 235 | 235 | pUrlData->path[i] = 0; |
| 236 | 236 | i++; |
| 237 | 237 | } |
| @@ -275,11 +275,11 @@ | ||
| 275 | 275 | pUrlData->path, zExe |
| 276 | 276 | ); |
| 277 | 277 | } |
| 278 | 278 | if( pUrlData->isSsh && pUrlData->path[1] ){ |
| 279 | 279 | char *zOld = pUrlData->path; |
| 280 | - pUrlData->path = mprintf("%s", zOld+1); | |
| 280 | + pUrlData->path = fossil_strdup(zOld+1); | |
| 281 | 281 | fossil_free(zOld); |
| 282 | 282 | } |
| 283 | 283 | free(zLogin); |
| 284 | 284 | }else if( strncmp(zUrl, "file:", 5)==0 ){ |
| 285 | 285 | pUrlData->isFile = 1; |
| @@ -286,14 +286,14 @@ | ||
| 286 | 286 | if( zUrl[5]=='/' && zUrl[6]=='/' ){ |
| 287 | 287 | i = 7; |
| 288 | 288 | }else{ |
| 289 | 289 | i = 5; |
| 290 | 290 | } |
| 291 | - zFile = mprintf("%s", &zUrl[i]); | |
| 291 | + zFile = fossil_strdup(&zUrl[i]); | |
| 292 | 292 | }else if( file_isfile(zUrl, ExtFILE) ){ |
| 293 | 293 | pUrlData->isFile = 1; |
| 294 | - zFile = mprintf("%s", zUrl); | |
| 294 | + zFile = fossil_strdup(zUrl); | |
| 295 | 295 | }else if( file_isdir(zUrl, ExtFILE)==1 ){ |
| 296 | 296 | zFile = mprintf("%s/FOSSIL", zUrl); |
| 297 | 297 | if( file_isfile(zFile, ExtFILE) ){ |
| 298 | 298 | pUrlData->isFile = 1; |
| 299 | 299 | }else{ |
| 300 | 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 = 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 @@ | ||
| 521 | 521 | return 0; |
| 522 | 522 | } |
| 523 | 523 | uid = db_int(0, "SELECT uid FROM user WHERE login=%Q", zLogin); |
| 524 | 524 | if( uid ){ |
| 525 | 525 | g.userUid = uid; |
| 526 | - g.zLogin = mprintf("%s", zLogin); | |
| 526 | + g.zLogin = fossil_strdup(zLogin); | |
| 527 | 527 | return 1; |
| 528 | 528 | } |
| 529 | 529 | return 0; |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 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 = 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 @@ | ||
| 643 | 643 | if( pEntry->d_name[0]=='.' ){ |
| 644 | 644 | if( (scanFlags & SCAN_ALL)==0 ) continue; |
| 645 | 645 | if( pEntry->d_name[1]==0 ) continue; |
| 646 | 646 | if( pEntry->d_name[1]=='.' && pEntry->d_name[2]==0 ) continue; |
| 647 | 647 | } |
| 648 | - zOrigPath = mprintf("%s", blob_str(pPath)); | |
| 648 | + zOrigPath = fossil_strdup(blob_str(pPath)); | |
| 649 | 649 | zUtf8 = fossil_path_to_utf8(pEntry->d_name); |
| 650 | 650 | blob_appendf(pPath, "/%s", zUtf8); |
| 651 | 651 | zPath = blob_str(pPath); |
| 652 | 652 | if( glob_match(pIgnore1, &zPath[nPrefix+1]) || |
| 653 | 653 | glob_match(pIgnore2, &zPath[nPrefix+1]) ){ |
| @@ -657,11 +657,11 @@ | ||
| 657 | 657 | ? (file_isdir(zPath, eFType)==1) : (pEntry->d_type==DT_DIR) ){ |
| 658 | 658 | #else |
| 659 | 659 | }else if( file_isdir(zPath, eFType)==1 ){ |
| 660 | 660 | #endif |
| 661 | 661 | if( (scanFlags & SCAN_NESTED) || !vfile_top_of_checkout(zPath) ){ |
| 662 | - char *zSavePath = mprintf("%s", zPath); | |
| 662 | + char *zSavePath = fossil_strdup(zPath); | |
| 663 | 663 | int count = vfile_dir_scan(pPath, nPrefix, scanFlags, pIgnore1, |
| 664 | 664 | pIgnore2, eFType); |
| 665 | 665 | db_bind_text(&ins, ":file", &zSavePath[nPrefix+1]); |
| 666 | 666 | db_bind_int(&ins, ":count", count); |
| 667 | 667 | db_step(&ins); |
| 668 | 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 = 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 @@ | ||
| 574 | 574 | Blob wiki; |
| 575 | 575 | Manifest *pWiki = 0; |
| 576 | 576 | const char *zPageName; |
| 577 | 577 | const char *zMimetype = 0; |
| 578 | 578 | int isPopup = P("popup")!=0; |
| 579 | - char *zBody = mprintf("%s","<i>Empty Page</i>"); | |
| 579 | + char *zBody = fossil_strdup("<i>Empty Page</i>"); | |
| 580 | 580 | int noSubmenu = P("nsm")!=0 || g.isHome; |
| 581 | 581 | |
| 582 | 582 | login_check_credentials(); |
| 583 | 583 | if( !g.perm.RdWiki ){ login_needed(g.anon.RdWiki); return; } |
| 584 | 584 | zPageName = P("name"); |
| 585 | 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 = 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 @@ | ||
| 1154 | 1154 | "port number must be in the range 1 - 65535."); |
| 1155 | 1155 | } |
| 1156 | 1156 | if( !zRepository ){ |
| 1157 | 1157 | db_must_be_within_tree(); |
| 1158 | 1158 | }else if( file_isdir(zRepository, ExtFILE)==1 ){ |
| 1159 | - g.zRepositoryName = mprintf("%s", zRepository); | |
| 1159 | + g.zRepositoryName = fossil_strdup(zRepository); | |
| 1160 | 1160 | file_simplify_name(g.zRepositoryName, -1, 0); |
| 1161 | 1161 | }else{ |
| 1162 | 1162 | db_open_repository(zRepository); |
| 1163 | 1163 | } |
| 1164 | 1164 | db_close(0); |
| 1165 | 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 = 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 @@ | ||
| 496 | 496 | if( fossil_strcmp(zName, azDir[j])==0 ) break; |
| 497 | 497 | } |
| 498 | 498 | if( j>=nDir ){ |
| 499 | 499 | nDir++; |
| 500 | 500 | azDir = fossil_realloc(azDir, sizeof(azDir[0])*nDir); |
| 501 | - azDir[j] = mprintf("%s", zName); | |
| 501 | + azDir[j] = fossil_strdup(zName); | |
| 502 | 502 | zip_add_file(p, zName, 0, 0); |
| 503 | 503 | } |
| 504 | 504 | zName[i+1] = c; |
| 505 | 505 | } |
| 506 | 506 | } |
| 507 | 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] = 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 |