ECC-1314: GRIB1: Memory leak if conversion to GRIB2 fails

This commit is contained in:
Shahram Najm 2021-11-29 17:03:06 +00:00
parent 580300c007
commit 7c6411a634
1 changed files with 6 additions and 2 deletions

View File

@ -159,6 +159,7 @@ static int notify_change(grib_action* act, grib_accessor* notified,
loader.init_accessor = grib_init_accessor_from_handle;
if (h->kid != NULL) {
/* grib_handle_delete(tmp_handle); */
return GRIB_INTERNAL_ERROR;
}
@ -180,14 +181,17 @@ static int notify_change(grib_action* act, grib_accessor* notified,
/*err = GRIB_SUCCESS;*/
}
else {
grib_handle_delete(tmp_handle);
h->kid = NULL; /* ECC-1314: must set to NULL for grib_handle_delete(h) to work */
return err;
}
}
err = grib_section_adjust_sizes(tmp_handle->root, 1, 0);
if (err)
if (err) {
/* grib_handle_delete(tmp_handle); h->kid = NULL; */
return err;
}
grib_section_post_init(tmp_handle->root);
/* grib_recompute_sections_lengths(tmp_handle->root); */