Fossil SCM
Avoid comparing a variable to NULL after the memory it is pointing to has been freed. This is harmless, as implemented, but it is technically undefined behavior in C. (This is a bug in the specification of the C language, imho.)
Commit
4e126233caf6ef3d439955af866254758802a0d0
Parent
467c4269b0cfd47…
1 file changed
+1
-1
+1
-1
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -69,11 +69,10 @@ | ||
| 69 | 69 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 70 | 70 | rid |
| 71 | 71 | ); |
| 72 | 72 | /* 01234567890123 */ |
| 73 | 73 | fossil_print("%-13s %s %s\n", zUuidName, zUuid, zDate ? zDate : ""); |
| 74 | - free(zUuid); | |
| 75 | 74 | free(zDate); |
| 76 | 75 | } |
| 77 | 76 | if( zUuid && showComment ){ |
| 78 | 77 | zComment = db_text(0, |
| 79 | 78 | "SELECT coalesce(ecomment,comment) || " |
| @@ -80,10 +79,11 @@ | ||
| 80 | 79 | " ' (user: ' || coalesce(euser,user,'?') || ')' " |
| 81 | 80 | " FROM event WHERE objid=%d", |
| 82 | 81 | rid |
| 83 | 82 | ); |
| 84 | 83 | } |
| 84 | + free(zUuid); | |
| 85 | 85 | if( showFamily ){ |
| 86 | 86 | db_prepare(&q, "SELECT uuid, pid, isprim FROM plink JOIN blob ON pid=rid " |
| 87 | 87 | " WHERE cid=%d" |
| 88 | 88 | " ORDER BY isprim DESC, mtime DESC /*sort*/", rid); |
| 89 | 89 | while( db_step(&q)==SQLITE_ROW ){ |
| 90 | 90 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -69,11 +69,10 @@ | |
| 69 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 70 | rid |
| 71 | ); |
| 72 | /* 01234567890123 */ |
| 73 | fossil_print("%-13s %s %s\n", zUuidName, zUuid, zDate ? zDate : ""); |
| 74 | free(zUuid); |
| 75 | free(zDate); |
| 76 | } |
| 77 | if( zUuid && showComment ){ |
| 78 | zComment = db_text(0, |
| 79 | "SELECT coalesce(ecomment,comment) || " |
| @@ -80,10 +79,11 @@ | |
| 80 | " ' (user: ' || coalesce(euser,user,'?') || ')' " |
| 81 | " FROM event WHERE objid=%d", |
| 82 | rid |
| 83 | ); |
| 84 | } |
| 85 | if( showFamily ){ |
| 86 | db_prepare(&q, "SELECT uuid, pid, isprim FROM plink JOIN blob ON pid=rid " |
| 87 | " WHERE cid=%d" |
| 88 | " ORDER BY isprim DESC, mtime DESC /*sort*/", rid); |
| 89 | while( db_step(&q)==SQLITE_ROW ){ |
| 90 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -69,11 +69,10 @@ | |
| 69 | "SELECT datetime(mtime) || ' UTC' FROM event WHERE objid=%d", |
| 70 | rid |
| 71 | ); |
| 72 | /* 01234567890123 */ |
| 73 | fossil_print("%-13s %s %s\n", zUuidName, zUuid, zDate ? zDate : ""); |
| 74 | free(zDate); |
| 75 | } |
| 76 | if( zUuid && showComment ){ |
| 77 | zComment = db_text(0, |
| 78 | "SELECT coalesce(ecomment,comment) || " |
| @@ -80,10 +79,11 @@ | |
| 79 | " ' (user: ' || coalesce(euser,user,'?') || ')' " |
| 80 | " FROM event WHERE objid=%d", |
| 81 | rid |
| 82 | ); |
| 83 | } |
| 84 | free(zUuid); |
| 85 | if( showFamily ){ |
| 86 | db_prepare(&q, "SELECT uuid, pid, isprim FROM plink JOIN blob ON pid=rid " |
| 87 | " WHERE cid=%d" |
| 88 | " ORDER BY isprim DESC, mtime DESC /*sort*/", rid); |
| 89 | while( db_step(&q)==SQLITE_ROW ){ |
| 90 |