Corrected a number of issues reported by Coverity

This commit is contained in:
Ward Fisher 2013-04-01 21:49:37 +00:00
parent fdcf74a1f5
commit 53fcef8b52
7 changed files with 9 additions and 4 deletions

View File

@ -192,7 +192,7 @@ nc_get_iter(int ncid,
memset((void*)iterp,0,sizeof(nciter_t)); /* make sure it is initialized */
NC_CHECK(nc_inq_varndims(ncid, varid, &ndims));
dimids = (int *) emalloc((ndims + 1) * sizeof(size_t));
dimids = (size_t *) emalloc((ndims + 1) * sizeof(size_t));
iterp->dimsizes = (size_t *) emalloc((ndims + 1) * sizeof(size_t));
iterp->chunksizes = (size_t *) emalloc((ndims + 1) * sizeof(size_t));

View File

@ -119,6 +119,7 @@ list2const(Datalist* list)
con.nctype = NC_COMPOUND;
con.lineno = list->data[0].lineno;
con.value.compoundv = list;
con.filled = 0;
return con;
}
@ -634,6 +635,7 @@ emptycompoundconst(int lineno, Constant* c)
c->lineno = lineno;
c->nctype = NC_COMPOUND;
c->value.compoundv = builddatalist(0);
c->filled = 0;
return c;
}
@ -645,6 +647,7 @@ emptystringconst(int lineno, Constant* c)
c->nctype = NC_STRING;
c->value.stringv.len = 0;
c->value.stringv.stringv = NULL;
c->filled = 0;
return c;
}

View File

@ -1064,6 +1064,7 @@ makeenumconst(Symbol* econst)
consttype = NC_ENUM;
con.nctype = NC_ECONST;
con.lineno = lineno;
con.filled = 0;
/* fix up econst to be a ref to an econst*/
econst->objectclass = NC_TYPE;
econst->subclass = NC_ECONST;

View File

@ -3236,6 +3236,7 @@ makeenumconst(Symbol* econst)
consttype = NC_ENUM;
con.nctype = NC_ECONST;
con.lineno = lineno;
con.filled = 0;
/* fix up econst to be a ref to an econst*/
econst->objectclass = NC_TYPE;
econst->subclass = NC_ECONST;

View File

@ -492,7 +492,7 @@ processspecial1(Symbol* vsym)
unsigned long flags = vsym->var.special.flags;
int i,tag;
Constant con;
Datalist* dlist;
Datalist* dlist = NULL;
if(flags == 0) return; /* no specials defined */
con = nullconstant;
if((tag=(flags & _CHUNKSIZES_FLAG))) {

View File

@ -414,7 +414,7 @@ ocreadfile(FILE* file, int datastart, char** memp, size_t* lenp)
{
char* mem;
size_t len;
size_t pos;
ssize_t pos;
size_t red;
struct stat stats;

View File

@ -219,7 +219,7 @@ xxdr_free(XXDR* xdr)
int
xxdr_skip(XXDR* xdrs, off_t len)
{
unsigned int pos;
ssize_t pos;
pos = xxdr_getpos(xdrs);
pos = (pos + len);
if(pos < 0) pos = 0;