Skip to content

Commit

Permalink
close in right order
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsumner committed Jun 10, 2024
1 parent 1d59436 commit 5f66262
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion inst/include/gdalapplib/gdalapplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,13 @@ inline List gdalwarp_applib(CharacterVector source_filename,

CPLAssert( hRet != NULL );
GDALWarpAppOptionsFree(psOptions);

GDALClose((GDALDataset*) hRet);
for (int si = 0; si < source_filename.size(); si++) {
GDALClose( (GDALDataset *)poSrcDS[si] );
}
CPLFree(poSrcDS);

GDALClose((GDALDataset*) hRet);
List out(0);
return out;
}
Expand Down
4 changes: 2 additions & 2 deletions inst/include/gdalwarpgeneral/gdalwarpgeneral.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ inline List gdal_warp_general(CharacterVector dsn,
GDALWarpAppOptionsFree(psOptions);


CPLAssert( hRet != NULL );

for (int si = 0; si < dsn.size(); si++) {
GDALClose( (GDALDataset *)poSrcDS[si] );
GDALReleaseDataset( (GDALDataset *)poSrcDS[si] );
}
CPLFree(poSrcDS);

Expand Down

0 comments on commit 5f66262

Please sign in to comment.