Remove cppcheck warning re null pointer dereference

This commit is contained in:
Shahram Najm 2016-02-05 14:40:36 +00:00
parent 1f618cfc79
commit 43199c96e8
1 changed files with 384 additions and 383 deletions

View File

@ -148,7 +148,6 @@ static void dump_long(grib_dumper* d,grib_accessor* a,const char* comment)
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);
@ -176,6 +175,7 @@ static void dump_long(grib_dumper* d,grib_accessor* a,const char* comment)
int cols=19;
int count=0;
fprintf(self->dumper.out,"%s = { \t",a->name);
if (values) {
for (i=0;i<size;i++) {
if (count>cols) {fprintf(self->dumper.out,"\n\t\t\t\t");count=0;}
fprintf(self->dumper.out,"%ld ",values[i]);
@ -183,6 +183,7 @@ static void dump_long(grib_dumper* d,grib_accessor* a,const char* comment)
}
fprintf(self->dumper.out,"}\n");
grib_context_free(a->context,values);
}
} else {
if( ((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0) && grib_is_missing_internal(a) )
fprintf(self->dumper.out,"%s = MISSING",a->name);