From cc1cbe64a5953004c80b0da3026748ee3061bca0 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Sat, 31 Oct 2026 13:52:42 +0100 Subject: Use read-only references for complex types This fixes a double-free error in constructs such as: types mystruct struct dummy int end myalias alias pointer to mystruct --- src/prc1/parse.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/prc1/parse.h') diff --git a/src/prc1/parse.h b/src/prc1/parse.h index 8b61d78..f0ae691 100644 --- a/src/prc1/parse.h +++ b/src/prc1/parse.h @@ -52,8 +52,15 @@ struct type enum ttype {U, S, C, P, T, PTR, ARY, BUILTIN} type; const struct tk *tk; size_t sz, align; - int sign; - struct type *child, *next; + int sign, readonly; + + union + { + const struct type *ro; + struct type *rw; + } child; + + struct type *next; union { -- cgit v1.2.3