Skip to content

Commit

Permalink
fix double layer destruction in gdal postgis and exit failure if post…
Browse files Browse the repository at this point in the history
…gis connection failed
  • Loading branch information
Tom Commandeur committed Sep 4, 2018
1 parent 1e80a52 commit fa1e31e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Map3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ bool Map3d::get_pdok_output(std::string filename) {
OGRLayer *layer = create_gdal_layer(driver, tmpFilename, layername, attributes, f->get_class() == BUILDING);
if (layer == NULL) {
std::cerr << "ERROR: Cannot open database '" + filename + "' for writing" << std::endl;
close_gdal_resources(driver, layers);
GDALClose(driver);
return false;
}
layers.emplace(layername, layer);
Expand All @@ -440,7 +440,7 @@ bool Map3d::get_pdok_output(std::string filename) {

f->get_shape(layers[layername], true, extraAttribute);
}
close_gdal_resources(driver, layers);
GDALClose(driver);
return true;
#endif
}
Expand Down
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ int main(int argc, const char * argv[]) {
}
else {
std::cerr << "ERROR: Writing features failed for " << format << ". Aborting.\n";
return EXIT_FAILURE;
}
}

Expand Down

0 comments on commit fa1e31e

Please sign in to comment.