mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-30 16:10:44 +08:00
Resource leak, Coverity 1264409
This commit is contained in:
parent
64e69f26f3
commit
cb0cb6f674
14
oc2/oc.c
14
oc2/oc.c
@ -53,12 +53,15 @@ OCerror
|
||||
oc_open(const char* url, OCobject* linkp)
|
||||
{
|
||||
OCerror ocerr;
|
||||
OCstate* state;
|
||||
OCstate* state = NULL;
|
||||
if(!ocglobalstate.initialized) oc_initialize();
|
||||
ocerr = ocopen(&state,url);
|
||||
if(ocerr == OC_NOERR && linkp) {
|
||||
*linkp = (OCobject)(state);
|
||||
*linkp = (OCobject)(state);
|
||||
} else {
|
||||
if(state) free(state);
|
||||
}
|
||||
|
||||
return OCTHROW(ocerr);
|
||||
}
|
||||
|
||||
@ -2137,7 +2140,7 @@ oc_set_rcfile(const char* rcfile)
|
||||
ocinternalinitialize(); /* so ocglobalstate is defined, but not triplestore */
|
||||
if(rcfile == NULL) {
|
||||
ocglobalstate.rc.ignore = 1;
|
||||
} else {
|
||||
} else {
|
||||
FILE* f = fopen(rcfile,"r");
|
||||
if(f == NULL) {
|
||||
stat = (OC_ERCFILE);
|
||||
@ -2146,7 +2149,7 @@ oc_set_rcfile(const char* rcfile)
|
||||
fclose(f);
|
||||
ocglobalstate.rc.rcfile = strdup(rcfile);
|
||||
/* (re) load the rcfile and esp the triplestore*/
|
||||
stat = ocrc_load();
|
||||
stat = ocrc_load();
|
||||
}
|
||||
done:
|
||||
return OCTHROW(stat);
|
||||
@ -2183,9 +2186,8 @@ oc_initialize(void)
|
||||
ocglobalstate.initialized = 0;
|
||||
status = ocinternalinitialize();
|
||||
/* (re) load the rcfile */
|
||||
status = ocrc_load();
|
||||
status = ocrc_load();
|
||||
return OCTHROW(status);
|
||||
}
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user