Merge develop

This commit is contained in:
Shahram Najm 2019-12-02 17:24:25 +00:00
commit 12dbf226f1
2 changed files with 25 additions and 25 deletions

View File

@ -191,8 +191,10 @@ static int pack_double(grib_accessor* a, const double* val, size_t *len)
}
}
if((ret = grib_set_double_array_internal(h, self->values,values,size)) != GRIB_SUCCESS) return ret;
if((ret = grib_set_double_array_internal(h, self->values,values,size)) != GRIB_SUCCESS) {
grib_context_free(c,values);
return ret;
}
grib_context_free(c,values);
return GRIB_SUCCESS;

View File

@ -10,41 +10,39 @@
#include "grib_api_internal.h"
grib_concept_value* grib_concept_value_new(grib_context* c, const char* name,grib_concept_condition* conditions)
{
grib_concept_value* v = (grib_concept_value*)grib_context_malloc_clear_persistent(c,sizeof(grib_concept_value));
v->name = grib_context_strdup_persistent(c,name);
v->conditions = conditions;
return v;
grib_concept_value* v = (grib_concept_value*)grib_context_malloc_clear_persistent(c,sizeof(grib_concept_value));
v->name = grib_context_strdup_persistent(c,name);
v->conditions = conditions;
return v;
}
void grib_concept_value_delete(grib_context* c,grib_concept_value* v)
{
grib_concept_condition* e = v->conditions;
while(e)
{
grib_concept_condition* n = e->next;
grib_concept_condition_delete(c,e);
e = n;
}
grib_context_free_persistent(c,v->name);
grib_context_free_persistent(c,v);
grib_concept_condition* e = v->conditions;
while(e)
{
grib_concept_condition* n = e->next;
grib_concept_condition_delete(c,e);
e = n;
}
grib_context_free_persistent(c,v->name);
grib_context_free_persistent(c,v);
}
grib_concept_condition* grib_concept_condition_new(grib_context* c,const char* name,grib_expression* expression, grib_iarray* iarray)
{
grib_concept_condition* v = (grib_concept_condition*)grib_context_malloc_clear_persistent(c,sizeof(grib_concept_condition));
v->name = grib_context_strdup_persistent(c,name);
v->expression = expression;
v->iarray=iarray;
return v;
grib_concept_condition* v = (grib_concept_condition*)grib_context_malloc_clear_persistent(c,sizeof(grib_concept_condition));
v->name = grib_context_strdup_persistent(c,name);
v->expression = expression;
v->iarray=iarray;
return v;
}
void grib_concept_condition_delete(grib_context* c,grib_concept_condition* v)
{
grib_expression_free(c,v->expression);
grib_context_free_persistent(c,v->name);
grib_context_free_persistent(c,v);
grib_expression_free(c,v->expression);
grib_context_free_persistent(c,v->name);
grib_context_free_persistent(c,v);
}