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.

drh 2011-10-15 12:30 trunk
Commit 630691456be672299dc569de4a898d6dc17da39a
3 files changed +1 +1 -1 +2 -1
+1
--- src/cgi.c
+++ src/cgi.c
@@ -1162,10 +1162,11 @@
11621162
sleep( nchildren-MAX_PARALLEL );
11631163
}
11641164
delay.tv_sec = 60;
11651165
delay.tv_usec = 0;
11661166
FD_ZERO(&readfds);
1167
+ assert( listener>=0 );
11671168
FD_SET( listener, &readfds);
11681169
select( listener+1, &readfds, 0, 0, &delay);
11691170
if( FD_ISSET(listener, &readfds) ){
11701171
lenaddr = sizeof(inaddr);
11711172
connection = accept(listener, (struct sockaddr*)&inaddr, &lenaddr);
11721173
--- 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 @@
136136
Blob login; /* The login card */
137137
Blob payload; /* The complete payload including login card */
138138
Blob hdr; /* The HTTP request header */
139139
int closeConnection; /* True to close the connection when done */
140140
int iLength; /* Length of the reply payload */
141
- int rc; /* Result code */
141
+ int rc = 0; /* Result code */
142142
int iHttpVersion; /* Which version of HTTP protocol server uses */
143143
char *zLine; /* A single line of the reply header */
144144
int i; /* Loop counter */
145145
int isError = 0; /* True if the reply is an error message */
146146
int isCompressed = 1; /* True if the reply is compressed */
147147
--- 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 @@
9595
}
9696
9797
/*
9898
** Construct the path from path.pStart to path.pEnd in the u.pTo fields.
9999
*/
100
-void path_reverse_path(void){
100
+static void path_reverse_path(void){
101101
PathNode *p;
102
+ assert( path.pEnd!=0 );
102103
for(p=path.pEnd; p && p->pFrom; p = p->pFrom){
103104
p->pFrom->u.pTo = p;
104105
}
105106
path.pEnd->u.pTo = 0;
106107
assert( p==path.pStart );
107108
--- 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

Keyboard Shortcuts

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