From 695e05363173fa5d7e4d674686f3f11a864b8504 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 24 Nov 1998 01:21:37 +0000 Subject: fix memory leaks; itohy@netbsd --- usr.bin/lex/gen.c | 5 +++-- usr.bin/yacc/reader.c | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/usr.bin/lex/gen.c b/usr.bin/lex/gen.c index 6bf99d8de75..0f9099823f1 100644 --- a/usr.bin/lex/gen.c +++ b/usr.bin/lex/gen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gen.c,v 1.3 1996/07/13 22:22:01 millert Exp $ */ +/* $OpenBSD: gen.c,v 1.4 1998/11/24 01:21:36 deraadt Exp $ */ /* gen - actual generation (writing) of flex scanners */ @@ -28,7 +28,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -/* $Header: /cvs/OpenBSD/src/usr.bin/lex/gen.c,v 1.3 1996/07/13 22:22:01 millert Exp $ */ +/* $Header: /cvs/OpenBSD/src/usr.bin/lex/gen.c,v 1.4 1998/11/24 01:21:36 deraadt Exp $ */ #include "flexdef.h" @@ -1025,6 +1025,7 @@ void gentabs() } dataend(); + free(acc_array); } diff --git a/usr.bin/yacc/reader.c b/usr.bin/yacc/reader.c index 84e8fe6fce1..18fdff56b78 100644 --- a/usr.bin/yacc/reader.c +++ b/usr.bin/yacc/reader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: reader.c,v 1.5 1996/04/21 23:45:19 deraadt Exp $ */ +/* $OpenBSD: reader.c,v 1.6 1998/11/24 01:21:29 deraadt Exp $ */ /* $NetBSD: reader.c,v 1.5 1996/03/19 03:21:43 jtc Exp $ */ @@ -847,6 +847,7 @@ get_tag() if (c == EOF) unexpected_EOF(); if (c != '>') illegal_tag(t_lineno, t_line, t_cptr); + FREE(t_line); ++cptr; for (i = 0; i < ntags; ++i) @@ -869,7 +870,6 @@ get_tag() strcpy(s, cache); tag_table[ntags] = s; ++ntags; - FREE(t_line); return (s); } @@ -1403,6 +1403,7 @@ loop: case ';': if (depth > 0) goto loop; fprintf(f, "\nbreak;\n"); + FREE(a_line); return; case '{': @@ -1412,6 +1413,7 @@ loop: case '}': if (--depth > 0) goto loop; fprintf(f, "\nbreak;\n"); + FREE(a_line); return; case '\'': -- cgit v1.2.3