Skip to content

Commit

Permalink
Fix cppcheck warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
shahramn committed Oct 21, 2024
1 parent 2479a86 commit ce006ec
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ int LambertAzimuthalEqualArea::init_sphere(grib_handle* h,
return GRIB_OUT_OF_MEMORY;
}
lons_ = (double*)grib_context_malloc(h->context, nv * sizeof(double));
if (!lats_) {
if (!lons_) {
grib_context_log(h->context, GRIB_LOG_ERROR, "%s: Error allocating %zu bytes", ITER, nv * sizeof(double));
return GRIB_OUT_OF_MEMORY;
}
Expand Down
4 changes: 2 additions & 2 deletions src/geo_iterator/grib_iterator_class_lambert_conformal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ int LambertConformal::init_sphere(const grib_handle* h,
return GRIB_OUT_OF_MEMORY;
}
lons_ = (double*)grib_context_malloc(h->context, nv * sizeof(double));
if (!lats_) {
if (!lons_) {
grib_context_log(h->context, GRIB_LOG_ERROR, "%s: Error allocating %zu bytes", ITER, nv * sizeof(double));
return GRIB_OUT_OF_MEMORY;
}
Expand Down Expand Up @@ -291,7 +291,7 @@ int LambertConformal::init_oblate(const grib_handle* h,
return GRIB_OUT_OF_MEMORY;
}
lons_ = (double*)grib_context_malloc(h->context, nv * sizeof(double));
if (!lats_) {
if (!lons_) {
grib_context_log(h->context, GRIB_LOG_ERROR, "%s: Error allocating %zu bytes", ITER, nv * sizeof(double));
return GRIB_OUT_OF_MEMORY;
}
Expand Down
2 changes: 1 addition & 1 deletion src/geo_iterator/grib_iterator_class_mercator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ int Mercator::init_mercator(grib_handle* h,
return GRIB_OUT_OF_MEMORY;
}
lons_ = (double*)grib_context_malloc(h->context, nv * sizeof(double));
if (!lats_) {
if (!lons_) {
grib_context_log(h->context, GRIB_LOG_ERROR, "%s: Error allocating %zu bytes", ITER, nv * sizeof(double));
return GRIB_OUT_OF_MEMORY;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ int PolarStereographic::init(grib_handle* h, grib_arguments* args)
return GRIB_OUT_OF_MEMORY;
}
lons_ = (double*)grib_context_malloc(h->context, nv_ * sizeof(double));
if (!lats_) {
if (!lons_) {
grib_context_log(h->context, GRIB_LOG_ERROR, "%s: Error allocating %zu bytes", ITER, nv_ * sizeof(double));
return GRIB_OUT_OF_MEMORY;
}
Expand Down
2 changes: 1 addition & 1 deletion src/geo_iterator/grib_iterator_class_space_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ int SpaceView::init(grib_handle* h, grib_arguments* args)
return GRIB_OUT_OF_MEMORY;
}
lons_ = (double*)grib_context_malloc(h->context, array_size);
if (!lats_) {
if (!lons_) {
grib_context_log(h->context, GRIB_LOG_ERROR, "%s: Error allocating %zu bytes", ITER, array_size);
return GRIB_OUT_OF_MEMORY;
}
Expand Down

0 comments on commit ce006ec

Please sign in to comment.