Fossil SCM
Fix clang static analyzer warnings about deref null pointers and undefined values. There are still lots of dead code warnings, but those are harmless.
Commit
630691456be672299dc569de4a898d6dc17da39a
Parent
86d2b4efc8367e5…
3 files changed
+1
+1
-1
+2
-1
+1
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -1162,10 +1162,11 @@ | ||
| 1162 | 1162 | sleep( nchildren-MAX_PARALLEL ); |
| 1163 | 1163 | } |
| 1164 | 1164 | delay.tv_sec = 60; |
| 1165 | 1165 | delay.tv_usec = 0; |
| 1166 | 1166 | FD_ZERO(&readfds); |
| 1167 | + assert( listener>=0 ); | |
| 1167 | 1168 | FD_SET( listener, &readfds); |
| 1168 | 1169 | select( listener+1, &readfds, 0, 0, &delay); |
| 1169 | 1170 | if( FD_ISSET(listener, &readfds) ){ |
| 1170 | 1171 | lenaddr = sizeof(inaddr); |
| 1171 | 1172 | connection = accept(listener, (struct sockaddr*)&inaddr, &lenaddr); |
| 1172 | 1173 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -1162,10 +1162,11 @@ | |
| 1162 | sleep( nchildren-MAX_PARALLEL ); |
| 1163 | } |
| 1164 | delay.tv_sec = 60; |
| 1165 | delay.tv_usec = 0; |
| 1166 | FD_ZERO(&readfds); |
| 1167 | FD_SET( listener, &readfds); |
| 1168 | select( listener+1, &readfds, 0, 0, &delay); |
| 1169 | if( FD_ISSET(listener, &readfds) ){ |
| 1170 | lenaddr = sizeof(inaddr); |
| 1171 | connection = accept(listener, (struct sockaddr*)&inaddr, &lenaddr); |
| 1172 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -1162,10 +1162,11 @@ | |
| 1162 | sleep( nchildren-MAX_PARALLEL ); |
| 1163 | } |
| 1164 | delay.tv_sec = 60; |
| 1165 | delay.tv_usec = 0; |
| 1166 | FD_ZERO(&readfds); |
| 1167 | assert( listener>=0 ); |
| 1168 | FD_SET( listener, &readfds); |
| 1169 | select( listener+1, &readfds, 0, 0, &delay); |
| 1170 | if( FD_ISSET(listener, &readfds) ){ |
| 1171 | lenaddr = sizeof(inaddr); |
| 1172 | connection = accept(listener, (struct sockaddr*)&inaddr, &lenaddr); |
| 1173 |
+1
-1
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -136,11 +136,11 @@ | ||
| 136 | 136 | Blob login; /* The login card */ |
| 137 | 137 | Blob payload; /* The complete payload including login card */ |
| 138 | 138 | Blob hdr; /* The HTTP request header */ |
| 139 | 139 | int closeConnection; /* True to close the connection when done */ |
| 140 | 140 | int iLength; /* Length of the reply payload */ |
| 141 | - int rc; /* Result code */ | |
| 141 | + int rc = 0; /* Result code */ | |
| 142 | 142 | int iHttpVersion; /* Which version of HTTP protocol server uses */ |
| 143 | 143 | char *zLine; /* A single line of the reply header */ |
| 144 | 144 | int i; /* Loop counter */ |
| 145 | 145 | int isError = 0; /* True if the reply is an error message */ |
| 146 | 146 | int isCompressed = 1; /* True if the reply is compressed */ |
| 147 | 147 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -136,11 +136,11 @@ | |
| 136 | Blob login; /* The login card */ |
| 137 | Blob payload; /* The complete payload including login card */ |
| 138 | Blob hdr; /* The HTTP request header */ |
| 139 | int closeConnection; /* True to close the connection when done */ |
| 140 | int iLength; /* Length of the reply payload */ |
| 141 | int rc; /* Result code */ |
| 142 | int iHttpVersion; /* Which version of HTTP protocol server uses */ |
| 143 | char *zLine; /* A single line of the reply header */ |
| 144 | int i; /* Loop counter */ |
| 145 | int isError = 0; /* True if the reply is an error message */ |
| 146 | int isCompressed = 1; /* True if the reply is compressed */ |
| 147 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -136,11 +136,11 @@ | |
| 136 | Blob login; /* The login card */ |
| 137 | Blob payload; /* The complete payload including login card */ |
| 138 | Blob hdr; /* The HTTP request header */ |
| 139 | int closeConnection; /* True to close the connection when done */ |
| 140 | int iLength; /* Length of the reply payload */ |
| 141 | int rc = 0; /* Result code */ |
| 142 | int iHttpVersion; /* Which version of HTTP protocol server uses */ |
| 143 | char *zLine; /* A single line of the reply header */ |
| 144 | int i; /* Loop counter */ |
| 145 | int isError = 0; /* True if the reply is an error message */ |
| 146 | int isCompressed = 1; /* True if the reply is compressed */ |
| 147 |
+2
-1
| --- src/path.c | ||
| +++ src/path.c | ||
| @@ -95,12 +95,13 @@ | ||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /* |
| 98 | 98 | ** Construct the path from path.pStart to path.pEnd in the u.pTo fields. |
| 99 | 99 | */ |
| 100 | -void path_reverse_path(void){ | |
| 100 | +static void path_reverse_path(void){ | |
| 101 | 101 | PathNode *p; |
| 102 | + assert( path.pEnd!=0 ); | |
| 102 | 103 | for(p=path.pEnd; p && p->pFrom; p = p->pFrom){ |
| 103 | 104 | p->pFrom->u.pTo = p; |
| 104 | 105 | } |
| 105 | 106 | path.pEnd->u.pTo = 0; |
| 106 | 107 | assert( p==path.pStart ); |
| 107 | 108 |
| --- src/path.c | |
| +++ src/path.c | |
| @@ -95,12 +95,13 @@ | |
| 95 | } |
| 96 | |
| 97 | /* |
| 98 | ** Construct the path from path.pStart to path.pEnd in the u.pTo fields. |
| 99 | */ |
| 100 | void path_reverse_path(void){ |
| 101 | PathNode *p; |
| 102 | for(p=path.pEnd; p && p->pFrom; p = p->pFrom){ |
| 103 | p->pFrom->u.pTo = p; |
| 104 | } |
| 105 | path.pEnd->u.pTo = 0; |
| 106 | assert( p==path.pStart ); |
| 107 |
| --- src/path.c | |
| +++ src/path.c | |
| @@ -95,12 +95,13 @@ | |
| 95 | } |
| 96 | |
| 97 | /* |
| 98 | ** Construct the path from path.pStart to path.pEnd in the u.pTo fields. |
| 99 | */ |
| 100 | static void path_reverse_path(void){ |
| 101 | PathNode *p; |
| 102 | assert( path.pEnd!=0 ); |
| 103 | for(p=path.pEnd; p && p->pFrom; p = p->pFrom){ |
| 104 | p->pFrom->u.pTo = p; |
| 105 | } |
| 106 | path.pEnd->u.pTo = 0; |
| 107 | assert( p==path.pStart ); |
| 108 |