mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
Corrected a potential memory related error caused when a null pointer was free'd.
This commit is contained in:
parent
d67ad1adf1
commit
190fb4636b
@ -913,7 +913,7 @@ pr_attx(
|
||||
)
|
||||
{
|
||||
ncatt_t att; /* attribute */
|
||||
char *attvals = "";
|
||||
char *attvals = NULL;
|
||||
int attvalslen = 0;
|
||||
|
||||
NC_CHECK( nc_inq_attname(ncid, varid, ia, att.name) );
|
||||
@ -980,7 +980,8 @@ pr_attx(
|
||||
printf("%s\"",attvals);
|
||||
}
|
||||
printf (" />\n");
|
||||
free (attvals);
|
||||
if(attvals != NULL)
|
||||
free (attvals);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user