diff --git a/inst/include/gdalapplib/gdalapplib.h b/inst/include/gdalapplib/gdalapplib.h index 3c18c1b..59bbea3 100644 --- a/inst/include/gdalapplib/gdalapplib.h +++ b/inst/include/gdalapplib/gdalapplib.h @@ -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; } diff --git a/inst/include/gdalwarpgeneral/gdalwarpgeneral.h b/inst/include/gdalwarpgeneral/gdalwarpgeneral.h index 6a980d6..a84de74 100644 --- a/inst/include/gdalwarpgeneral/gdalwarpgeneral.h +++ b/inst/include/gdalwarpgeneral/gdalwarpgeneral.h @@ -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);