Coverity: 711710

This commit is contained in:
Ward Fisher 2014-08-25 10:34:06 -06:00
parent c9580fa109
commit e6a78c7a0b

View File

@ -168,7 +168,7 @@ ocopen(OCstate** statep, const char* url)
CURL* curl = NULL; /* curl handle*/
if(!ocuriparse(url,&tmpurl)) {OCTHROWCHK(stat=OC_EBADURL); goto fail;}
stat = occurlopen(&curl);
if(stat != OC_NOERR) {OCTHROWCHK(stat); goto fail;}
@ -191,7 +191,7 @@ ocopen(OCstate** statep, const char* url)
stat = ocsetcurlproperties(state);
if(statep) *statep = state;
return OCTHROW(stat);
return OCTHROW(stat);
fail:
ocurifree(tmpurl);
@ -207,7 +207,7 @@ ocfetch(OCstate* state, const char* constraint, OCdxd kind, OCflags flags,
OCtree* tree = NULL;
OCnode* root = NULL;
OCerror stat = OC_NOERR;
tree = (OCtree*)ocmalloc(sizeof(OCtree));
MEMCHECK(tree,OC_ENOMEM);
memset((void*)tree,0,sizeof(OCtree));
@ -283,7 +283,7 @@ ocfetch(OCstate* state, const char* constraint, OCdxd kind, OCflags flags,
/* Check and report on an error return from the server */
if(stat == OC_EDAPSVC && state->error.code != NULL) {
oclog(OCLOGERR,"oc_open: server error retrieving url: code=%s message=\"%s\"",
state->error.code,
state->error.code,
(state->error.message?state->error.message:""));
}
if(stat) {OCTHROWCHK(stat); goto fail;}
@ -340,7 +340,7 @@ fprintf(stderr,"ocfetch.datadds.memory: datasize=%lu bod=%lu\n",
if(dataError(tree->data.xdrs,state)) {
stat = OC_EDATADDS;
oclog(OCLOGERR,"oc_open: server error retrieving url: code=%s message=\"%s\"",
state->error.code,
state->error.code,
(state->error.message?state->error.message:""));
goto fail;
}
@ -422,7 +422,7 @@ occlose(OCstate* state)
ocfree(state->ssl.key);
ocfree(state->ssl.keypasswd);
ocfree(state->ssl.cainfo);
ocfree(state->ssl.capath);
ocfree(state->ssl.capath);
ocfree(state->proxy.host);
ocfree(state->creds.username);
ocfree(state->creds.password);
@ -503,7 +503,10 @@ fprintf(stderr,"missing bod: ddslen=%lu bod=%lu\n",
} else
tree->text = NULL;
/* reset the position of the tmp file*/
fseek(tree->data.file,(long)tree->data.bod,SEEK_SET);
if(fseek(tree->data.file,(long)tree->data.bod,SEEK_SET) < 0) {
stat = OC_EDATADDS;
return OCTHROW(stat);
}
if(tree->text == NULL) stat = OC_EDATADDS;
return OCTHROW(stat);
}
@ -591,7 +594,7 @@ ocsetcurlproperties(OCstate* state)
/* Some servers (e.g. thredds and columbia) appear to require a place
to put cookies in order for some security functions to work
*/
if(state->curlflags.cookiejar == NULL
if(state->curlflags.cookiejar == NULL
|| *state->curlflags.cookiejar) {
#if 1
/* Apparently anything non-null will work */
@ -601,7 +604,7 @@ ocsetcurlproperties(OCstate* state)
char* tmp;
int fd;
int stat;
tmp = (char*)malloc(strlen(ocglobalstate.home)
+strlen("/")
+strlen(OCDIR)
@ -621,7 +624,7 @@ ocsetcurlproperties(OCstate* state)
errno = 0;
/* Create the actual cookie file */
stat = ocmktmp(tmp,&state->curlflags.cookiejar,&fd);
close(fd);
close(fd);
#if 0
fd = creat(tmp,S_IRUSR | S_IWUSR);
@ -681,7 +684,7 @@ dataError(XXDR* xdrs, OCstate* state)
depth--;
if(depth == 0) {i++; break;}
}
}
}
errmsg = (char*)malloc((size_t)i+1);
if(errmsg == NULL) {errfound = 1; goto done;}
xxdr_setpos(xdrs,ckp);