Fossil SCM

Fix two cases where a string value might be used after being freed.

drh 2013-05-29 14:01 trunk
Commit 04ab1af3e02ff47bbd3b448b16365eab59cdb29a
2 files changed -1 +1 -2
--- src/attach.c
+++ src/attach.c
@@ -484,11 +484,10 @@
484484
@ <tr><th>Wiki&nbsp;Page:</th>
485485
@ <td>%z(href("%R/wiki?name=%t",zWikiName))%h(zWikiName)</a></td></tr>
486486
}
487487
@ <tr><th>Date:</th><td>
488488
hyperlink_to_date(zDate, "</td></tr>");
489
- free(zDate);
490489
@ <tr><th>User:</th><td>
491490
hyperlink_to_user(pAttach->zUser, zDate, "</td></tr>");
492491
@ <tr><th>Artifact&nbsp;Attached:</th>
493492
@ <td>%z(href("%R/artifact/%s",zSrc))%s(zSrc)</a>
494493
if( g.perm.Setup ){
495494
--- src/attach.c
+++ src/attach.c
@@ -484,11 +484,10 @@
484 @ <tr><th>Wiki&nbsp;Page:</th>
485 @ <td>%z(href("%R/wiki?name=%t",zWikiName))%h(zWikiName)</a></td></tr>
486 }
487 @ <tr><th>Date:</th><td>
488 hyperlink_to_date(zDate, "</td></tr>");
489 free(zDate);
490 @ <tr><th>User:</th><td>
491 hyperlink_to_user(pAttach->zUser, zDate, "</td></tr>");
492 @ <tr><th>Artifact&nbsp;Attached:</th>
493 @ <td>%z(href("%R/artifact/%s",zSrc))%s(zSrc)</a>
494 if( g.perm.Setup ){
495
--- src/attach.c
+++ src/attach.c
@@ -484,11 +484,10 @@
484 @ <tr><th>Wiki&nbsp;Page:</th>
485 @ <td>%z(href("%R/wiki?name=%t",zWikiName))%h(zWikiName)</a></td></tr>
486 }
487 @ <tr><th>Date:</th><td>
488 hyperlink_to_date(zDate, "</td></tr>");
 
489 @ <tr><th>User:</th><td>
490 hyperlink_to_user(pAttach->zUser, zDate, "</td></tr>");
491 @ <tr><th>Artifact&nbsp;Attached:</th>
492 @ <td>%z(href("%R/artifact/%s",zSrc))%s(zSrc)</a>
493 if( g.perm.Setup ){
494
+1 -2
--- src/file.c
+++ src/file.c
@@ -192,15 +192,14 @@
192192
return;
193193
}
194194
zName[i] = '/';
195195
}
196196
}
197
- if( zName!=zBuf ) free(zName);
198
-
199197
if( symlink(zTargetFile, zName)!=0 ){
200198
fossil_fatal_recursive("unable to create symlink \"%s\"", zName);
201199
}
200
+ if( zName!=zBuf ) free(zName);
202201
}else
203202
#endif
204203
{
205204
Blob content;
206205
blob_set(&content, zTargetFile);
207206
--- src/file.c
+++ src/file.c
@@ -192,15 +192,14 @@
192 return;
193 }
194 zName[i] = '/';
195 }
196 }
197 if( zName!=zBuf ) free(zName);
198
199 if( symlink(zTargetFile, zName)!=0 ){
200 fossil_fatal_recursive("unable to create symlink \"%s\"", zName);
201 }
 
202 }else
203 #endif
204 {
205 Blob content;
206 blob_set(&content, zTargetFile);
207
--- src/file.c
+++ src/file.c
@@ -192,15 +192,14 @@
192 return;
193 }
194 zName[i] = '/';
195 }
196 }
 
 
197 if( symlink(zTargetFile, zName)!=0 ){
198 fossil_fatal_recursive("unable to create symlink \"%s\"", zName);
199 }
200 if( zName!=zBuf ) free(zName);
201 }else
202 #endif
203 {
204 Blob content;
205 blob_set(&content, zTargetFile);
206

Keyboard Shortcuts

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