mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
Addressed coverity issue 1256385, potential resource leak.
This commit is contained in:
parent
d8e86219b5
commit
ad201da5f1
14
oc2/ocrc.c
14
oc2/ocrc.c
@ -718,14 +718,20 @@ rc_search(const char* prefix, const char* rcname, char** pathp)
|
||||
oclog(OCLOGDBG, "Found rc file=%s",path);
|
||||
done:
|
||||
if(f == NULL || stat != OC_NOERR) {
|
||||
if(path != NULL)
|
||||
if(path != NULL)
|
||||
free(path);
|
||||
path = NULL;
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
if(f != NULL)
|
||||
fclose(f);
|
||||
fclose(f);
|
||||
if(pathp != NULL)
|
||||
*pathp = path;
|
||||
*pathp = path;
|
||||
else {
|
||||
free(path);
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
return OCTHROW(stat);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user