Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libipsec plug memory leak. from ebisawa@iij, sync w/kame



details:   https://anonhg.NetBSD.org/src/rev/59d2e339a2d2
branches:  trunk
changeset: 534641:59d2e339a2d2
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed Jul 31 07:00:22 2002 +0000

description:
plug memory leak.  from ebisawa@iij, sync w/kame

diffstat:

 lib/libipsec/policy_parse.y |   5 ++++-
 lib/libipsec/policy_token.l |  18 +++++++++++++-----
 2 files changed, 17 insertions(+), 6 deletions(-)

diffs (64 lines):

diff -r b35f166f912c -r 59d2e339a2d2 lib/libipsec/policy_parse.y
--- a/lib/libipsec/policy_parse.y       Wed Jul 31 06:48:58 2002 +0000
+++ b/lib/libipsec/policy_parse.y       Wed Jul 31 07:00:22 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: policy_parse.y,v 1.7 2001/08/31 09:53:23 itojun Exp $  */
+/*     $NetBSD: policy_parse.y,v 1.8 2002/07/31 07:00:22 itojun Exp $  */
 /*     $KAME: policy_parse.y,v 1.10 2000/05/07 05:25:03 itojun Exp $   */
 
 /*
@@ -85,6 +85,7 @@
 static caddr_t policy_parse __P((char *msg, int msglen));
 
 extern void __policy__strbuffer__init__ __P((char *msg));
+extern void __policy__strbuffer__free__ __P((void));
 extern int yyparse __P((void));
 extern int yylex __P((void));
 
@@ -399,6 +400,8 @@
        __policy__strbuffer__init__(msg);
 
        error = yyparse();      /* it must be set errcode. */
+       __policy__strbuffer__free__();
+
        if (error) {
                if (pbuf != NULL)
                        free(pbuf);
diff -r b35f166f912c -r 59d2e339a2d2 lib/libipsec/policy_token.l
--- a/lib/libipsec/policy_token.l       Wed Jul 31 06:48:58 2002 +0000
+++ b/lib/libipsec/policy_token.l       Wed Jul 31 07:00:22 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: policy_token.l,v 1.6 2001/08/31 09:53:23 itojun Exp $  */
+/*     $NetBSD: policy_token.l,v 1.7 2002/07/31 07:00:23 itojun Exp $  */
 /*     $KAME: policy_token.l,v 1.11 2000/12/01 10:08:29 sakane Exp $   */
 
 /*
@@ -133,16 +133,24 @@
 %%
 
 void __policy__strbuffer__init__ __P((char *));
+void __policy__strbuffer__free__ __P((void));
+
+static YY_BUFFER_STATE strbuffer;
 
 void
 __policy__strbuffer__init__(msg)
        char *msg;
 {
-       YY_BUFFER_STATE yyb;
-
-       yyb = (YY_BUFFER_STATE)yy_scan_string(msg);
-       yy_switch_to_buffer(yyb);
+       strbuffer = (YY_BUFFER_STATE)yy_scan_string(msg);
+       yy_switch_to_buffer(strbuffer);
 
        return;
 }
 
+void
+__policy__strbuffer__free__()
+{
+       yy_delete_buffer(strbuffer);
+
+       return;
+}



Home | Main Index | Thread Index | Old Index