Error handling: Memory leak

This commit is contained in:
Shahram Najm 2023-07-20 12:35:18 +00:00
parent 72f917077d
commit 87c768ff18
1 changed files with 3 additions and 1 deletions

View File

@ -366,8 +366,10 @@ int grib_nearest_find_generic(
return GRIB_OUT_OF_MEMORY;
iter = grib_iterator_new(h, 0, &ret);
if (ret)
if (ret) {
free(neighbours);
return ret;
}
/* First pass: collect all latitudes and longitudes */
while (grib_iterator_next(iter, &lat, &lon, &the_value)) {
++the_index;