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

Coverity.
This commit is contained in:
Mark Andrews
2006-01-04 03:43:20 +00:00
parent f0af75009b
commit 8019162f81
37 changed files with 330 additions and 190 deletions

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_api.c,v 1.48.2.1.2.8 2005/06/18 01:03:24 marka Exp $ */
/* $Id: t_api.c,v 1.48.2.1.2.9 2006/01/04 03:43:20 marka Exp $ */
#include <config.h>
@@ -540,7 +540,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);
@@ -747,8 +751,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) {