aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-06-18 01:50:21 -0400
committerB. Watson <urchlay@slackware.uk>2024-06-18 01:50:21 -0400
commit600c7fcd2ca1827cb1e02d8821878410ae410638 (patch)
treef4d5685c91c0256dc7935406f4611defce016f63
parente1ba78324eccdb4db798bf05d640d616ccecc217 (diff)
downloadbw-atari8-tools-600c7fcd2ca1827cb1e02d8821878410ae410638.tar.gz
cxrefbas and renumbas: free allocated memory on exit.
-rw-r--r--cxrefbas.c1
-rw-r--r--linetab.c5
-rw-r--r--linetab.h1
-rw-r--r--renumbas.c1
4 files changed, 8 insertions, 0 deletions
diff --git a/cxrefbas.c b/cxrefbas.c
index 5111e18..ad7a640 100644
--- a/cxrefbas.c
+++ b/cxrefbas.c
@@ -67,6 +67,7 @@ int main(int argc, char **argv) {
build_ref_table();
print_ref_table();
+ free_ref_table();
return 0;
}
diff --git a/linetab.c b/linetab.c
index 1889689..5fb0a32 100644
--- a/linetab.c
+++ b/linetab.c
@@ -164,3 +164,8 @@ void build_ref_table(void) {
on_start_stmt = on_cmd_token = on_exp_token = on_var_token = 0;
}
+void free_ref_table(void) {
+ int i;
+ for(i = 0; i < 32768; i++)
+ if(linerefs[i]) free(linerefs[i]);
+}
diff --git a/linetab.h b/linetab.h
index c6aeb15..e38335a 100644
--- a/linetab.h
+++ b/linetab.h
@@ -20,3 +20,4 @@ extern int lines_exist[];
extern void add_lineref(unsigned short from, unsigned short pos);
extern void build_ref_table(void);
+extern void free_ref_table(void);
diff --git a/renumbas.c b/renumbas.c
index 3eafc5e..abe3029 100644
--- a/renumbas.c
+++ b/renumbas.c
@@ -119,6 +119,7 @@ int main(int argc, char **argv) {
build_ref_table();
renumber();
+ free_ref_table();
open_output(output_filename);
writefile();