and bufr_dump memory
@@ -124,21 +124,22 @@ static int destroy(grib_dumper* d)
static void dump_values(grib_dumper* d,grib_accessor* a)
{
grib_dumper_json *self = (grib_dumper_json*)d;
- double value; size_t size = 1;
+ double value=0; size_t size = 1;
double *values = NULL;
int err = 0;
int i;
int cols = 9;
long count = 0;
double missing_value = GRIB_MISSING_DOUBLE;
- grib_handle* h=grib_handle_of_accessor(a);
-
- grib_value_count(a,&count);
- size=count;
+ grib_handle* h = NULL;
if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 )
return;
+ h = grib_handle_of_accessor(a);
+ grib_value_count(a,&count);
+ size=count;
+
if (size>1) {
values=(double*)grib_context_malloc_clear(a->context,sizeof(double)*size);
err=grib_unpack_double(a,values,&size);
@@ -208,19 +209,20 @@ static void dump_values(grib_dumper* d,grib_accessor* a)
static void dump_long(grib_dumper* d,grib_accessor* a,const char* comment)
{
grib_dumper_json *self = (grib_dumper_json*)d;
- long value; size_t size = 1;
+ long value = 0;
+ size_t size = 1;
long *values = NULL;
int err = 0;
int i;
int cols = 9;
long count = 0;
- grib_value_count(a,&count);
- size=count;
-
if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 )
return;
+ grib_value_count(a,&count);
+ size=count;
+
if (size>1) {
values=(long*)grib_context_malloc_clear(a->context,sizeof(long)*size);
err=grib_unpack_long(a,values,&size);
@@ -291,12 +293,14 @@ static void dump_bits(grib_dumper* d,grib_accessor* a,const char* comment)
static void dump_double(grib_dumper* d,grib_accessor* a,const char* comment)
{
grib_dumper_json *self = (grib_dumper_json*)d;
- double value; size_t size = 1;
+ double value = 0;
+ size_t size = 1;
- grib_unpack_double(a,&value,&size);
if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0)
return;
+ grib_unpack_double(a,&value,&size);
+
if (self->begin==0 && self->empty==0 && self->isAttribute==0) fprintf(self->dumper.out,",\n");
else self->begin=0;
@@ -334,7 +338,6 @@ static void dump_string_array(grib_dumper* d,grib_accessor* a,const char* commen
grib_context* c = NULL;
int err = 0;
long count = 0;
-
c=a->context;
if ( (a->flags & GRIB_ACCESSOR_FLAG_DUMP) == 0 )
