Skip to content
Snippets Groups Projects
Commit 595bf621 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

BUG: use new to allocate the array of GCPs, as its size is not known at compile time

parent 3e7484d4
No related branches found
No related tags found
No related merge requests found
......@@ -171,7 +171,7 @@ Projection::GCPParam GDALDatasetWrapper::GetGCPParam() const
void GDALDatasetWrapper::SetGCPParam(Projection::GCPParam gcpParam)
{
int nGCPCount = gcpParam.GCPs.size();
GDAL_GCP gcps[nGCPCount];
auto gcps = new GDAL_GCP[nGCPCount];
GDAL_GCP *gcpIt = gcps;
for (auto otbGcpIt = gcpParam.GCPs.cbegin() ; otbGcpIt != gcpParam.GCPs.cend() ; ++otbGcpIt, gcpIt++)
{
......@@ -186,6 +186,8 @@ void GDALDatasetWrapper::SetGCPParam(Projection::GCPParam gcpParam)
*gcpIt = gdalGcp;
}
m_Dataset->SetGCPs(nGCPCount, gcps, gcpParam.GCPProjection.c_str());
// The GCPs are copied in the dataset.
delete[] gcps;
}
} // end namespace otb
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment