Fix destroy() function

This commit is contained in:
Eugen Betke 2024-04-09 20:32:45 +00:00
parent 8a58ba106e
commit cec5b2f4e1
10 changed files with 8 additions and 6 deletions

View File

@ -3242,4 +3242,5 @@ void grib_accessor_class_bufr_data_array_t::destroy(grib_context* c, grib_access
}
grib_iarray_delete(self->iss_list);
grib_accessor_class_gen_t::destroy(c, a);
}

View File

@ -497,6 +497,7 @@ void grib_accessor_class_bufr_data_element_t::destroy(grib_context* ct, grib_acc
a->attributes[i] = NULL;
i++;
}
grib_accessor_class_gen_t::destroy(ct, a);
}
#define MAX_STRING_SIZE 4096

View File

@ -82,4 +82,5 @@ int grib_accessor_class_bufr_string_values_t::value_count(grib_accessor* a, long
return descriptors->value_count(rlen);}
void grib_accessor_class_bufr_string_values_t::destroy(grib_context* c, grib_accessor* a){
grib_accessor_class_ascii_t::destroy(c, a);
}

View File

@ -775,6 +775,7 @@ void grib_accessor_class_codetable_t::destroy(grib_context* context, grib_access
grib_context_free(context, a->vvalue);
a->vvalue = NULL;
}
grib_accessor_class_unsigned_t::destroy(context, a);
}
int grib_accessor_class_codetable_t::get_native_type(grib_accessor* a)

View File

@ -424,6 +424,7 @@ int grib_accessor_class_concept_t::get_native_type(grib_accessor* a){
void grib_accessor_class_concept_t::destroy(grib_context* c, grib_accessor* a){
//grib_accessor_concept_t *self = (grib_accessor_concept_t*)a;
//grib_context_free(c,self->cval);
grib_accessor_class_gen_t::destroy(c, a);
}
int grib_accessor_class_concept_t::unpack_string(grib_accessor* a, char* val, size_t* len){

View File

@ -1203,4 +1203,5 @@ void grib_accessor_class_data_g1second_order_general_extended_packing_t::destroy
grib_context_free(context, self->fvalues);
self->fvalues = NULL;
}
grib_accessor_class_data_simple_packing_t::destroy(context, a);
}

View File

@ -725,6 +725,7 @@ int grib_accessor_class_expanded_descriptors_t::value_count(grib_accessor* a, lo
}
void grib_accessor_class_expanded_descriptors_t::destroy(grib_context* c, grib_accessor* a){
grib_accessor_class_long_t::destroy(c, a);
// grib_accessor_expanded_descriptors_t* self = (grib_accessor_expanded_descriptors_t*)a;
// if (self->rank==0 && self->expanded)
// grib_bufr_descriptors_array_delete(self->expanded);

View File

@ -9,7 +9,6 @@
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
#include "grib_api_internal.h"
#include "grib_accessor_class_getenv.h"
grib_accessor_class_getenv_t _grib_accessor_class_getenv{"getenv"};

View File

@ -1,4 +1,3 @@
/*
* (C) Copyright 2005- ECMWF.
*
@ -12,13 +11,11 @@
#ifndef eccodes_accessor_getenv_h
#define eccodes_accessor_getenv_h
#include "../grib_api_internal.h"
#include "grib_accessor_class_ascii.h"
class grib_accessor_getenv_t : public grib_accessor_ascii_t
{
public:
/* Members defined in getenv */
const char* name;
char* value;
const char* default_value;
@ -35,4 +32,5 @@ public:
int value_count(grib_accessor*, long*) override;
void init(grib_accessor*, const long, grib_arguments*) override;
};
#endif /* eccodes_accessor_getenv_h */

View File

@ -171,7 +171,6 @@ static int notify_change(grib_action* act, grib_accessor* notified,
/*err = GRIB_SUCCESS;*/
}
else {
// TODO(maee): segmentation fault
grib_handle_delete(tmp_handle);
h->kid = NULL; /* ECC-1314: must set to NULL for grib_handle_delete(h) to work */
return err;
@ -204,7 +203,6 @@ static int notify_change(grib_action* act, grib_accessor* notified,
Assert(tmp_handle->dependencies == NULL);
/* printf("grib_handle_delete %p\n",(void*)tmp_handle); */
//TODO(maee): causes segmentation fault
grib_handle_delete(tmp_handle);
h->use_trie = 1;