Bug found by: CppCheck 1.59 (static source analysis tool)
Signed-off-by: Philipp Kloke <philipp.kloke@web.de>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
} else if (fseek(fp, 0L, SEEK_END) < 0) {
error(ERR_NONFATAL, "`incbin': unable to seek on file `%s'",
fname);
+ fclose(fp);
} else {
static char buf[4096];
size_t t = instruction->times;
if ((p = strchr(buf, '\n')) != NULL)
*p = '\0';
if (i >= 128) {
+ fclose(f);
fprintf(stderr, "ldrdf: too many input files\n");
exit(1);
}
*(respstrings + i) = newstr(buf);
argc++, i++;
}
+ fclose(f);
break;
}
case '2':
if (f->d)
free(f->d);
free(f);
+ free(hdr);
return NULL;
}
int rdl_verify(const char *filename)
{
- FILE *fp = fopen(filename, "rb");
+ FILE *fp;
char buf[257];
int i;
int32_t length;
if (lastresult != -1 && !strcmp(filename, lastverified))
return lastresult;
+ fp = fopen(filename, "rb");
strcpy(lastverified, filename);
if (!fp)