Commit 37d44daf authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

zaxis_print: check nvals.

parent a27ca063
......@@ -44,7 +44,7 @@ void zaxis_print_kernel(int zaxisID, FILE *fp)
attstr[0] = 0; cdiZaxisInqKeyStr(zaxisID, CDI_KEY_UNITS, CDI_MAX_NAME, attstr);
if ( attstr[0] ) fprintf(fp, "units = \"%s\"\n", attstr);
double *vals = (double*) Malloc(nvals*sizeof(double));
double *vals = nvals ? (double*) Malloc(nvals*sizeof(double)) : NULL;
if ( nvals )
{
......@@ -68,7 +68,7 @@ void zaxis_print_kernel(int zaxisID, FILE *fp)
}
}
Free(vals);
if ( vals ) Free(vals);
if ( type == ZAXIS_HYBRID || type == ZAXIS_HYBRID_HALF )
{
......
Supports Markdown
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