mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-02-23 16:59:54 +08:00
Addressed coverity issue 711901
This commit is contained in:
parent
906f2ae3ac
commit
2cce056ce9
17
oc2/ocrc.c
17
oc2/ocrc.c
@ -149,7 +149,8 @@ parseproxy(OCstate* state, char* v)
|
||||
{
|
||||
char *host_pos = NULL;
|
||||
char *port_pos = NULL;
|
||||
|
||||
if(v == NULL)
|
||||
return OC_NOERR; /* nothing there */
|
||||
if(strlen(v) == 0) return OC_NOERR; /* nothing there*/
|
||||
if (occredentials_in_url(v)) {
|
||||
char *result_url = NULL;
|
||||
@ -263,7 +264,7 @@ sorttriplestore(void)
|
||||
nsorted++;
|
||||
if(ocdebug > 2)
|
||||
ocdodsrcdump("pass:",sorted,nsorted);
|
||||
}
|
||||
}
|
||||
|
||||
memcpy((void*)ocdodsrc->triples,(void*)sorted,sizeof(struct OCTriple)*nsorted);
|
||||
free(sorted);
|
||||
@ -305,7 +306,7 @@ ocdodsrc_read(char* basename, char* path)
|
||||
if(linecount >= MAXRCLINES) {
|
||||
oclog(OCLOGERR, ".dodsrc has too many lines");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
line = line0;
|
||||
/* check for comment */
|
||||
c = line[0];
|
||||
@ -314,7 +315,7 @@ ocdodsrc_read(char* basename, char* path)
|
||||
if(strlen(line) >= MAXRCLINESIZE) {
|
||||
oclog(OCLOGERR, "%s line too long: %s",basename,line0);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* setup */
|
||||
ocdodsrc->triples[ocdodsrc->ntriples].url[0] = '\0';
|
||||
ocdodsrc->triples[ocdodsrc->ntriples].key[0] = '\0';
|
||||
@ -325,7 +326,7 @@ ocdodsrc_read(char* basename, char* path)
|
||||
if(rtag == NULL) {
|
||||
oclog(OCLOGERR, "Malformed [url] in %s entry: %s",basename,line);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
line = rtag + 1;
|
||||
*rtag = '\0';
|
||||
/* save the url */
|
||||
@ -485,13 +486,13 @@ ocdodsrc_process(OCstate* state)
|
||||
state->creds.password = strdup(sep+1);
|
||||
}
|
||||
|
||||
/* else ignore */
|
||||
/* else ignore */
|
||||
|
||||
done:
|
||||
if(url != NULL) free(url);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
ocdodsrc_lookup(char* key, char* url)
|
||||
{
|
||||
@ -517,7 +518,7 @@ ocdodsrc_lookup(char* key, char* url)
|
||||
if(found) {
|
||||
fprintf(stderr,"lookup %s: [%s]%s = %s\n",url,triple->url,triple->key,triple->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (found ? triple->value : NULL);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user