Geoiterators: Initialise lats_ and lons_ (fix valgrind error)

This commit is contained in:
shahramn 2024-10-22 11:12:10 +01:00
parent 51f3a2b210
commit 095eff61e2
2 changed files with 5 additions and 3 deletions

View File

@ -15,6 +15,8 @@ namespace eccodes::geo_iterator {
int Gen::init(grib_handle* h, grib_arguments* args)
{
int err = GRIB_SUCCESS;
lats_ = lons_ = NULL;
if ((err = Iterator::init(h, args)) != GRIB_SUCCESS)
return err;

View File

@ -51,15 +51,15 @@ int Regular::destroy()
const grib_context* c = h_->context;
grib_context_free(c, lats_);
grib_context_free(c, lons_);
lats_ = lons_ = NULL;
return Gen::destroy();
}
int Regular::init(grib_handle* h, grib_arguments* args)
{
int ret = GRIB_SUCCESS;
if ((ret = Gen::init(h, args)) != GRIB_SUCCESS)
return ret;
int ret = Gen::init(h, args);
if (ret != GRIB_SUCCESS) return ret;
long Ni; /* Number of points along a parallel = Nx */
long Nj; /* Number of points along a meridian = Ny */