1940. [bug] Fixed a number of error conditions reported by

Coverity.
This commit is contained in:
Mark Andrews
2005-11-30 03:33:49 +00:00
parent 91be6c5ba2
commit 2674e1a455
42 changed files with 356 additions and 207 deletions

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_api.c,v 1.57 2005/06/17 02:22:45 marka Exp $ */
/* $Id: t_api.c,v 1.58 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@@ -542,7 +542,11 @@ t_fgetbs(FILE *fp) {
}
}
*p = '\0';
return(((c == EOF) && (n == 0U)) ? NULL : buf);
if (c == EOF && n == 0U) {
free(buf);
return (NULL);
}
return (buf);
} else {
fprintf(stderr, "malloc failed %d", errno);
return(NULL);
@@ -749,8 +753,10 @@ t_eval(const char *filename, int (*func)(char **), int nargs) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = t_bustline(p, tokens);
if (cnt == nargs) {