aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--assemble.c1
-rw-r--r--rdoff/ldrdf.c2
-rw-r--r--rdoff/rdfload.c1
-rw-r--r--rdoff/rdlib.c3
4 files changed, 6 insertions, 1 deletions
diff --git a/assemble.c b/assemble.c
index 235be13a..b119f869 100644
--- a/assemble.c
+++ b/assemble.c
@@ -424,6 +424,7 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, uint32_t cp,
} 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;
diff --git a/rdoff/ldrdf.c b/rdoff/ldrdf.c
index 2ddada33..7c61d4cf 100644
--- a/rdoff/ldrdf.c
+++ b/rdoff/ldrdf.c
@@ -1275,12 +1275,14 @@ int main(int argc, char **argv)
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':
diff --git a/rdoff/rdfload.c b/rdoff/rdfload.c
index 4fd3dbd0..5a7ab631 100644
--- a/rdoff/rdfload.c
+++ b/rdoff/rdfload.c
@@ -94,6 +94,7 @@ rdfmodule *rdfload(const char *filename)
if (f->d)
free(f->d);
free(f);
+ free(hdr);
return NULL;
}
diff --git a/rdoff/rdlib.c b/rdoff/rdlib.c
index 31dbdb4b..838f1407 100644
--- a/rdoff/rdlib.c
+++ b/rdoff/rdlib.c
@@ -59,7 +59,7 @@ char *rdl_errors[5] = {
int rdl_verify(const char *filename)
{
- FILE *fp = fopen(filename, "rb");
+ FILE *fp;
char buf[257];
int i;
int32_t length;
@@ -69,6 +69,7 @@ int rdl_verify(const char *filename)
if (lastresult != -1 && !strcmp(filename, lastverified))
return lastresult;
+ fp = fopen(filename, "rb");
strcpy(lastverified, filename);
if (!fp)