2
0
mirror of https://github.com/Unidata/netcdf-c.git synced 2025-03-07 17:08:02 +08:00

Corrected minor null check issue reported by Coverity: 1302448

This commit is contained in:
Ward Fisher 2015-09-22 15:35:30 -06:00
parent a8df681331
commit f1d2470776

View File

@ -456,12 +456,13 @@ fprintf(stderr,"realloc: %lu/%lu -> %lu/%lu\n",
return NC_NOERR;
}
/* Write out any dirty buffers to disk and
ensure that next read will get data from disk.
Sync any changes, then close the open file associated with the ncio
struct, and free its memory.
nciop - pointer to ncio to close.
doUnlink - if true, unlink file
/*! Write out any dirty buffers to disk.
Write out any dirty buffers to disk and ensure that next read will get data from disk. Sync any changes, then close the open file associated with the ncio struct, and free its memory.
@param[in] nciop pointer to ncio to close.
@param[in] doUnlink if true, unlink file
@return NC_NOERR on success, error code on failure.
*/
static int
@ -470,10 +471,11 @@ memio_close(ncio* nciop, int doUnlink)
int status = NC_NOERR;
NCMEMIO* memio ;
int fd = -1;
int inmemory = (fIsSet(nciop->ioflags,NC_INMEMORY));
int inmemory = 0;
if(nciop == NULL || nciop->pvt == NULL) return NC_NOERR;
inmemory = (fIsSet(nciop->ioflags,NC_INMEMORY));
memio = (NCMEMIO*)nciop->pvt;
assert(memio != NULL);