ECC-982 and ECC-765: BUFR leak in operator attributes

This commit is contained in:
Shahram Najm 2019-08-30 16:29:57 +01:00
parent 2e8368b3f8
commit 98d2040a19
1 changed files with 9 additions and 1 deletions

View File

@ -271,7 +271,6 @@ static int unpack_long(grib_accessor* a, long* val, size_t *len)
*val = (long)ac->dval;
*len = 1;
return GRIB_SUCCESS;
}
static int get_native_type(grib_accessor* a)
@ -283,8 +282,17 @@ static int get_native_type(grib_accessor* a)
static void destroy(grib_context* c,grib_accessor* a)
{
grib_accessor_variable *self = (grib_accessor_variable*)a;
int i=0;
grib_context_free(c,self->cval);
if (self->cname) grib_context_free(c,self->cname); /* ECC-765 */
/* Note: BUFR operator descriptors are variables and have attributes so need to free them */
while (i<MAX_ACCESSOR_ATTRIBUTES && a->attributes[i]) {
grib_accessor_delete(c, a->attributes[i]);
a->attributes[i]=NULL;
++i;
}
}
static int unpack_string(grib_accessor* a, char* val, size_t *len){