File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ int read_style_file( const std::string &filename, export_list *exlist )
158
158
if ( fields < 3 )
159
159
{
160
160
fprintf ( stderr, " Error reading style file line %d (fields=%d)\n " , lineno, fields );
161
+ fclose (in);
161
162
util::exit_nicely ();
162
163
}
163
164
@@ -176,6 +177,7 @@ int read_style_file( const std::string &filename, export_list *exlist )
176
177
((temp.name .find (' ?' ) != std::string::npos) ||
177
178
(temp.name .find (' *' ) != std::string::npos))) {
178
179
fprintf ( stderr, " wildcard '%s' in non-delete style entry\n " ,temp.name .c_str ());
180
+ fclose (in);
179
181
util::exit_nicely ();
180
182
}
181
183
@@ -203,6 +205,7 @@ int read_style_file( const std::string &filename, export_list *exlist )
203
205
// do we really want to completely quit on an unusable line?
204
206
if ( !kept )
205
207
{
208
+ fclose (in);
206
209
throw std::runtime_error ((boost::format (" Weird style line %1%:%2%" )
207
210
% filename % lineno).str ());
208
211
}
@@ -211,13 +214,15 @@ int read_style_file( const std::string &filename, export_list *exlist )
211
214
212
215
213
216
if (ferror (in)) {
217
+ int err = errno;
218
+ fclose (in);
214
219
throw std::runtime_error ((boost::format (" %1%: %2%" )
215
- % filename % strerror (errno )).str ());
220
+ % filename % strerror (err )).str ());
216
221
}
222
+ fclose (in);
217
223
if (num_read == 0 ) {
218
224
throw std::runtime_error (" Unable to parse any valid columns from "
219
225
" the style file. Aborting." );
220
226
}
221
- fclose (in);
222
227
return enable_way_area;
223
228
}
You can’t perform that action at this time.
0 commit comments