|
1 Developed in-house, fed to community. |
|
2 http://redmine.lighttpd.net/issues/2530 |
|
3 Partially accepted, others should be fixed by version or not |
|
4 at all, parfait annotations are ignored. Target version 1.4.34. |
|
5 |
|
6 --- src/mod_webdav.c 2013-10-11 07:42:39.116745543 -0700 |
|
7 +++ src/mod_webdav.c 2013-10-11 07:43:19.220464118 -0700 |
|
8 @@ -1717,7 +1717,7 @@ |
|
9 if (-1 == c->file.fd && /* open the file if not already open */ |
|
10 -1 == (c->file.fd = open(c->file.name->ptr, O_RDONLY))) { |
|
11 log_error_write(srv, __FILE__, __LINE__, "ss", "open failed: ", strerror(errno)); |
|
12 - |
|
13 + close(fd); |
|
14 return HANDLER_ERROR; |
|
15 } |
|
16 |
|
17 @@ -1726,7 +1726,7 @@ |
|
18 strerror(errno), c->file.name, c->file.fd); |
|
19 close(c->file.fd); |
|
20 c->file.fd = -1; |
|
21 - |
|
22 + close(fd); |
|
23 return HANDLER_ERROR; |
|
24 } |
|
25 |
|
26 --- src/lempar.c 2012-08-31 07:11:20.000000000 -0700 |
|
27 +++ src/lempar.c 2013-10-14 02:10:29.201323553 -0700 |
|
28 @@ -486,6 +486,9 @@ |
|
29 }else if( yyact == YYNSTATE + YYNRULE + 1 ){ |
|
30 yy_accept(yypParser); |
|
31 } |
|
32 + /* Parfait_ALLOW memory-leak - false positive for variable yygotominor - memory is properly freed in function yy_accept above */ |
|
33 + /* parfait needs two comments here to stop complaining and accept Parfait_ALLOW directive, I don't know why */ |
|
34 + return; |
|
35 } |
|
36 |
|
37 /* |
|
38 --- src/mod_mysql_vhost.c 2010-08-17 02:04:38.000000000 -0700 |
|
39 +++ src/mod_mysql_vhost.c 2013-10-14 03:48:47.184131818 -0700 |
|
40 @@ -217,7 +217,10 @@ |
|
41 |
|
42 if (config_insert_values_global(srv, |
|
43 ((data_config *)srv->config_context->data[i])->value, |
|
44 - cv)) return HANDLER_ERROR; |
|
45 + cv)) { |
|
46 + buffer_free(sel); |
|
47 + return HANDLER_ERROR; |
|
48 + } |
|
49 |
|
50 s->mysql_pre = buffer_init(); |
|
51 s->mysql_post = buffer_init(); |
|
52 @@ -248,7 +251,7 @@ |
|
53 |
|
54 if (NULL == (s->mysql = mysql_init(NULL))) { |
|
55 log_error_write(srv, __FILE__, __LINE__, "s", "mysql_init() failed, exiting..."); |
|
56 - |
|
57 + buffer_free(sel); |
|
58 return HANDLER_ERROR; |
|
59 } |
|
60 |
|
61 @@ -268,7 +271,7 @@ |
|
62 FOO(mydb), s->port, FOO(mysock), 0)) { |
|
63 #endif |
|
64 log_error_write(srv, __FILE__, __LINE__, "s", mysql_error(s->mysql)); |
|
65 - |
|
66 + buffer_free(sel); |
|
67 return HANDLER_ERROR; |
|
68 } |
|
69 #undef FOO |
|
70 --- src/lemon.c 2012-08-31 07:11:20.000000000 -0700 |
|
71 +++ src/lemon.c 2013-10-14 04:29:24.547185717 -0700 |
|
72 @@ -453,13 +453,11 @@ |
|
73 #define acttab_yylookahead(X,N) ((X)->aAction[N].lookahead) |
|
74 |
|
75 /* Free all memory associated with the given acttab */ |
|
76 -/* |
|
77 PRIVATE void acttab_free(acttab *p){ |
|
78 free( p->aAction ); |
|
79 free( p->aLookahead ); |
|
80 free( p ); |
|
81 } |
|
82 -*/ |
|
83 |
|
84 /* Allocate a new acttab structure */ |
|
85 PRIVATE acttab *acttab_alloc(void){ |
|
86 @@ -3582,6 +3580,7 @@ |
|
87 |
|
88 fclose(in); |
|
89 fclose(out); |
|
90 + acttab_free(pActtab); |
|
91 return; |
|
92 } |
|
93 |
|
94 --- src/fdevent.c 2012-08-31 07:11:20.000000000 -0700 |
|
95 +++ src/fdevent.c 2013-10-14 03:55:48.707756259 -0700 |
|
96 @@ -77,6 +77,7 @@ |
|
97 |
|
98 log_error_write(ev->srv, __FILE__, __LINE__, "S", |
|
99 "event-handler is unknown, try to set server.event-handler = \"poll\" or \"select\""); |
|
100 + free(ev); |
|
101 return NULL; |
|
102 } |
|
103 |
|
104 --- src/array.c 2010-08-17 02:04:38.000000000 -0700 |
|
105 +++ src/array.c 2013-10-14 07:05:54.354135229 -0700 |
|
106 @@ -168,6 +168,7 @@ |
|
107 data_unset *array_replace(array *a, data_unset *du) { |
|
108 int ndx; |
|
109 |
|
110 + if (du == NULL) return NULL; |
|
111 if (-1 == (ndx = array_get_index(a, du->key->ptr, du->key->used, NULL))) { |
|
112 array_insert_unique(a, du); |
|
113 return NULL; |
|
114 --- src/configfile.c 2012-11-07 06:50:29.000000000 -0800 |
|
115 +++ src/configfile.c 2013-10-15 06:45:37.918474628 -0700 |
|
116 @@ -1121,7 +1121,7 @@ |
|
117 if (NULL != getcwd(dcwd->value->ptr, dcwd->value->size - 1)) { |
|
118 dcwd->value->used = strlen(dcwd->value->ptr) + 1; |
|
119 buffer_copy_string_len(dcwd->key, CONST_STR_LEN("var.CWD")); |
|
120 - array_insert_unique(srv->config, (data_unset *)dcwd); |
|
121 + if (array_insert_unique(srv->config, (data_unset *)dcwd) == -1) dcwd->free(dcwd); |
|
122 } |
|
123 |
|
124 ret = config_parse_file(srv, &context, fn); |
|
125 @@ -1131,12 +1131,14 @@ |
|
126 context_free(&context); |
|
127 |
|
128 if (0 != ret) { |
|
129 + /* Parfait_ALLOW memory-leak - false positive dcwd variable - memory is properly freed on server close */ |
|
130 return ret; |
|
131 } |
|
132 |
|
133 if (NULL != (dc = (data_config *)array_get_element(srv->config_context, "global"))) { |
|
134 srv->config = dc->value; |
|
135 } else { |
|
136 + /* Parfait_ALLOW memory-leak - false positive dcwd variable - memory is properly freed on server close */ |
|
137 return -1; |
|
138 } |
|
139 |
|
140 @@ -1146,6 +1148,7 @@ |
|
141 |
|
142 if (modules->type != TYPE_ARRAY) { |
|
143 fprintf(stderr, "server.modules must be an array"); |
|
144 + /* Parfait_ALLOW memory-leak - false positive dcwd variable - memory is properly freed on server close */ |
|
145 return -1; |
|
146 } |
|
147 |
|
148 @@ -1159,19 +1162,23 @@ |
|
149 } |
|
150 |
|
151 prepends = (data_array *)configparser_merge_data((data_unset *)prepends, (data_unset *)modules); |
|
152 + if (prepends == NULL) { |
|
153 + /* Parfait_ALLOW memory-leak - false positive dcwd variable - memory is properly freed on server close */ |
|
154 + return -1; |
|
155 + } |
|
156 buffer_copy_string_buffer(prepends->key, modules->key); |
|
157 array_replace(srv->config, (data_unset *)prepends); |
|
158 modules->free((data_unset *)modules); |
|
159 modules = prepends; |
|
160 |
|
161 /* append default modules */ |
|
162 - if (NULL == array_get_element(modules->value, "mod_dirlisting")) { |
|
163 + if (modules != NULL && NULL == array_get_element(modules->value, "mod_dirlisting")) { |
|
164 ds = data_string_init(); |
|
165 buffer_copy_string_len(ds->value, CONST_STR_LEN("mod_dirlisting")); |
|
166 array_insert_unique(modules->value, (data_unset *)ds); |
|
167 } |
|
168 |
|
169 - if (NULL == array_get_element(modules->value, "mod_staticfile")) { |
|
170 + if (modules != NULL && NULL == array_get_element(modules->value, "mod_staticfile")) { |
|
171 ds = data_string_init(); |
|
172 buffer_copy_string_len(ds->value, CONST_STR_LEN("mod_staticfile")); |
|
173 array_insert_unique(modules->value, (data_unset *)ds); |
|
174 @@ -1200,9 +1207,11 @@ |
|
175 |
|
176 |
|
177 if (0 != config_insert(srv)) { |
|
178 + /* Parfait_ALLOW memory-leak - false positive dcwd variable - memory is properly freed on server close */ |
|
179 return -1; |
|
180 } |
|
181 |
|
182 + /* Parfait_ALLOW memory-leak - false positive dcwd variable - memory is properly freed on server close */ |
|
183 return 0; |
|
184 } |
|
185 |