From a0afde267c138c9cdc5c4cc247199ae3f1b90f6c Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 2 Sep 2019 16:41:41 +0100 Subject: [PATCH] ECC-982 and ECC-765: BUFR leak --- src/grib_accessor_class_bufr_data_array.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/grib_accessor_class_bufr_data_array.c b/src/grib_accessor_class_bufr_data_array.c index 1ae2667ed..d20018324 100644 --- a/src/grib_accessor_class_bufr_data_array.c +++ b/src/grib_accessor_class_bufr_data_array.c @@ -2456,9 +2456,11 @@ static int create_keys(grib_accessor* a,long onlySubset,long startSubset,long en associatedFieldAccessor=NULL; if (elementFromBitmap && self->unpackMode==CODES_BUFR_UNPACK_STRUCTURE) { if (descriptor->code != 33007 && descriptor->code != 223255 ) { + char* aname = grib_context_strdup(c,elementFromBitmap->name); grib_accessor* newAccessor=grib_accessor_clone(elementAccessor,section,&err); newAccessor->parent=groupSection; - newAccessor->name=grib_context_strdup(c,elementFromBitmap->name); + newAccessor->name=aname; + grib_sarray_push(a->context, self->tempStrings, aname); grib_push_accessor(newAccessor,groupSection->block); rank=grib_data_accessors_trie_push(self->dataAccessorsTrie,newAccessor); grib_accessors_list_push(self->dataAccessors,newAccessor,rank);