Fossil SCM

Corrected potential mishandling of memory ownership in the previous commit.

stephan 2021-02-06 04:48 mainmenu-override
Commit d6e698c2657b41a975d8e29203ba8e92b91b41d4f30926644cdac641148c75f9
1 file changed +2 -2
+2 -2
--- src/main.c
+++ src/main.c
@@ -2345,12 +2345,12 @@
23452345
**
23462346
** Use the contents of FILENAME as the value of the site's
23472347
** "mainmenu" setting, overriding the contents (for this
23482348
** request) of the db-side setting or the hard-coded default.
23492349
*/
2350
- g.zMainMenuFile = blob_str(&value);
2351
- value = empty_blob/*take over ownership*/;
2350
+ g.zMainMenuFile = mprintf("%s", blob_str(&value));
2351
+ blob_reset(&value);
23522352
continue;
23532353
}
23542354
if( blob_eq(&key, "cgi-debug:") && blob_token(&line, &value) ){
23552355
/* cgi-debug: FILENAME
23562356
**
23572357
--- src/main.c
+++ src/main.c
@@ -2345,12 +2345,12 @@
2345 **
2346 ** Use the contents of FILENAME as the value of the site's
2347 ** "mainmenu" setting, overriding the contents (for this
2348 ** request) of the db-side setting or the hard-coded default.
2349 */
2350 g.zMainMenuFile = blob_str(&value);
2351 value = empty_blob/*take over ownership*/;
2352 continue;
2353 }
2354 if( blob_eq(&key, "cgi-debug:") && blob_token(&line, &value) ){
2355 /* cgi-debug: FILENAME
2356 **
2357
--- src/main.c
+++ src/main.c
@@ -2345,12 +2345,12 @@
2345 **
2346 ** Use the contents of FILENAME as the value of the site's
2347 ** "mainmenu" setting, overriding the contents (for this
2348 ** request) of the db-side setting or the hard-coded default.
2349 */
2350 g.zMainMenuFile = mprintf("%s", blob_str(&value));
2351 blob_reset(&value);
2352 continue;
2353 }
2354 if( blob_eq(&key, "cgi-debug:") && blob_token(&line, &value) ){
2355 /* cgi-debug: FILENAME
2356 **
2357

Keyboard Shortcuts

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