Commit a73c0397 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

vlist_att.find_att: allocate attribute only if size > 0

parent d020b9f2
......@@ -3,6 +3,7 @@
* cdfInqContents: bug fix for inconsistent curvilinear grid [report: Holger Goettel]
* cdfInqContents: check type of _FillValue
* gridCompare: compare grid.yinc only if set
* vlist_att.find_att: allocate attribute only if size > 0
* grid_check_cyclic: bug fix
* Version 1.1.1 released
......
......@@ -92,8 +92,11 @@ void fill_att(CDI_att *attp, int type, size_t nelems, size_t xsz, const void *xv
attp->type = type;
attp->nelems = nelems;
attp->xvalue = (void *) malloc(xsz);
memcpy(attp->xvalue, xvalue, xsz);
if ( xsz > 0 )
{
attp->xvalue = (void *) malloc(xsz);
memcpy(attp->xvalue, xvalue, xsz);
}
}
......@@ -246,7 +249,8 @@ int vlist_inq_att(int type, int vlistID, int varID, const char *name, size_t mxs
{
xsz = attp->xsz;
if ( mxsz < xsz ) xsz = mxsz;
memcpy(xp, attp->xvalue, xsz);
if ( xsz > 0 )
memcpy(xp, attp->xvalue, xsz);
}
else
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment