mirror of https://github.com/ecmwf/eccodes.git
Fix issues reported by cppcheck
This commit is contained in:
parent
ea43cfe0e4
commit
62946c8ae0
|
@ -258,6 +258,7 @@ void grib_file_pool_delete_file(grib_file* file) {
|
||||||
if (prev->next==file) break;
|
if (prev->next==file) break;
|
||||||
prev=prev->next;
|
prev=prev->next;
|
||||||
}
|
}
|
||||||
|
Assert(prev);
|
||||||
prev->next=file->next;
|
prev->next=file->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -792,7 +792,7 @@ grib_handle* taf_new_from_file ( grib_context* c, FILE* f,int headers_only,int *
|
||||||
if ( !gl )
|
if ( !gl )
|
||||||
{
|
{
|
||||||
*error = GRIB_DECODING_ERROR;
|
*error = GRIB_DECODING_ERROR;
|
||||||
grib_context_log ( gl->context, GRIB_LOG_ERROR, "grib_handle_new_from_file : cannot create handle \n" );
|
grib_context_log ( c, GRIB_LOG_ERROR, "grib_handle_new_from_file : cannot create handle \n" );
|
||||||
grib_context_free ( c,data );
|
grib_context_free ( c,data );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -833,7 +833,7 @@ grib_handle* metar_new_from_file ( grib_context* c, FILE* f,int headers_only,int
|
||||||
if ( !gl )
|
if ( !gl )
|
||||||
{
|
{
|
||||||
*error = GRIB_DECODING_ERROR;
|
*error = GRIB_DECODING_ERROR;
|
||||||
grib_context_log ( gl->context, GRIB_LOG_ERROR, "grib_handle_new_from_file : cannot create handle \n" );
|
grib_context_log ( c, GRIB_LOG_ERROR, "grib_handle_new_from_file : cannot create handle \n" );
|
||||||
grib_context_free ( c,data );
|
grib_context_free ( c,data );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -873,7 +873,7 @@ grib_handle* codes_new_from_file ( grib_context* c, FILE* f,int headers_only,int
|
||||||
if ( !gl )
|
if ( !gl )
|
||||||
{
|
{
|
||||||
*error = GRIB_DECODING_ERROR;
|
*error = GRIB_DECODING_ERROR;
|
||||||
grib_context_log ( gl->context, GRIB_LOG_ERROR, "grib_handle_new_from_file : cannot create handle \n" );
|
grib_context_log ( c, GRIB_LOG_ERROR, "grib_handle_new_from_file : cannot create handle \n" );
|
||||||
grib_context_free ( c,data );
|
grib_context_free ( c,data );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,12 +36,12 @@ grib_iarray* grib_iarray_new(grib_context* c,size_t size,size_t incsize) {
|
||||||
if (!c) c=grib_context_get_default();
|
if (!c) c=grib_context_get_default();
|
||||||
|
|
||||||
v=(grib_iarray*)grib_context_malloc(c,sizeof(grib_iarray));
|
v=(grib_iarray*)grib_context_malloc(c,sizeof(grib_iarray));
|
||||||
v->context=c;
|
|
||||||
if (!v) {
|
if (!v) {
|
||||||
grib_context_log(c,GRIB_LOG_ERROR,
|
grib_context_log(c,GRIB_LOG_ERROR,
|
||||||
"grib_iarray_new unable to allocate %d bytes\n",sizeof(grib_iarray));
|
"grib_iarray_new unable to allocate %d bytes\n",sizeof(grib_iarray));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
v->context=c;
|
||||||
v->size=size;
|
v->size=size;
|
||||||
v->n=0;
|
v->n=0;
|
||||||
v->incsize=incsize;
|
v->incsize=incsize;
|
||||||
|
|
|
@ -50,8 +50,8 @@ int grib_lookup_long_from_array(grib_context* gc,grib_loader* loader,const char*
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return GRIB_NOT_FOUND;
|
|
||||||
printf("lookup: wrong type (%d)\n",type);
|
printf("lookup: wrong type (%d)\n",type);
|
||||||
|
return GRIB_NOT_FOUND;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue