summary refs log tree commit diff
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin@c9x.me>2022-04-11 14:35:19 +0200
committerQuentin Carbonneaux <quentin@c9x.me>2022-04-11 14:36:36 +0200
commit5f4b42abc730186afe19b889b6526bc244b8669d (patch)
tree373eee4ef2211b6d247c35c254cff9d6322a5497
parentc6b41eb8c8cece8266b2173a83216e1ce77eb2be (diff)
downloadroux-5f4b42abc730186afe19b889b6526bc244b8669d.tar.gz
do not leak type fields
Thanks to Daniel Xu for reporting.
-rw-r--r--parse.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/parse.c b/parse.c
index 70c291b..972c2e2 100644
--- a/parse.c
+++ b/parse.c
@@ -1092,6 +1092,7 @@ void
 parse(FILE *f, char *path, void data(Dat *), void func(Fn *))
 {
 	Lnk lnk;
+	uint n;
 
 	lexinit();
 	inf = f;
@@ -1115,6 +1116,9 @@ parse(FILE *f, char *path, void data(Dat *), void func(Fn *))
 			parsetyp();
 			break;
 		case Teof:
+			for (n=0; n<ntyp; n++)
+				if (typ[n].nunion)
+					vfree(typ[n].fields);
 			vfree(typ);
 			return;
 		}