* src/join.c (struct line): Use the COUNTED_BY attribute on the fields
member.
(struct seq): Use the COUNTED_BY attribute on the lines member.
(freeline): When setting a pointer using the COUNTED_BY attribute to
NULL, set its counter to zero.
---
 src/join.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/join.c b/src/join.c
index 4346758a6..999f248c8 100644
--- a/src/join.c
+++ b/src/join.c
@@ -74,7 +74,7 @@ struct line
     struct linebuffer buf;     /* The line itself.  */
     idx_t nfields;             /* Number of elements in 'fields'.  */
     idx_t nfields_allocated;   /* Number of elements allocated for 'fields'. */
-    struct field *fields;
+    struct field *fields COUNTED_BY (nfields_allocated);
   };
 
 /* One or more consecutive lines read from a file that all have the
@@ -83,7 +83,7 @@ struct seq
   {
     idx_t count;               /* Elements used in 'lines'.  */
     idx_t alloc;               /* Elements allocated in 'lines'.  */
-    struct line **lines;
+    struct line **lines COUNTED_BY (alloc);
   };
 
 /* The previous line read from each file.  */
@@ -348,8 +348,10 @@ freeline (struct line *line)
     return;
   free (line->fields);
   line->fields = NULL;
+  line->nfields_allocated = 0;
   free (line->buf.buffer);
   line->buf.buffer = NULL;
+  line->buf.size = 0;
 }
 
 /* Return <0 if the join field in LINE1 compares less than the one in LINE2;
-- 
2.55.0


Reply via email to