mirror of https://github.com/ecmwf/eccodes.git
ECC-1314: GRIB1: Memory leak if conversion to GRIB2 fails
This commit is contained in:
parent
580300c007
commit
7c6411a634
|
@ -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); */
|
||||
|
|
Loading…
Reference in New Issue