diff --git a/tools/grib_merge.c b/tools/grib_merge.c index d97bf359d..d54a7dadb 100644 --- a/tools/grib_merge.c +++ b/tools/grib_merge.c @@ -318,6 +318,16 @@ static grib_handle* merge(grib_handle* h1, grib_handle* h2) grib_set_double_array(h, "values", v, n); + grib_context_free(h->context, v); + grib_context_free(h->context, v1); + grib_context_free(h->context, v2); + grib_context_free(h->context, lat); + grib_context_free(h->context, lat1); + grib_context_free(h->context, lat2); + grib_context_free(h->context, lon); + grib_context_free(h->context, lon1); + grib_context_free(h->context, lon2); + return h; }