From 31914c7fcdcb04a6778ffe59a31e37122f7cdc14 Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 12 Apr 2007 04:25:58 +0000 Subject: [PATCH] vpip_make_binary_const cannot free the string passed in to it. --- vvp/parse.y | 9 +++++++-- vvp/vpi_const.cc | 8 +++++--- vvp/vpi_priv.h | 7 +++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/vvp/parse.y b/vvp/parse.y index 2101bc4b8..126495726 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: parse.y,v 1.90 2007/04/10 01:26:16 steve Exp $" +#ident "$Id: parse.y,v 1.91 2007/04/12 04:25:58 steve Exp $" #endif # include "parse_misc.h" @@ -668,7 +668,9 @@ argument : T_STRING { $$ = vpip_make_string_const($1); } | T_VECTOR - { $$ = vpip_make_binary_const($1.idx, $1.text); } + { $$ = vpip_make_binary_const($1.idx, $1.text); + free($1.text); + } ; @@ -816,6 +818,9 @@ int compile_design(const char*path) /* * $Log: parse.y,v $ + * Revision 1.91 2007/04/12 04:25:58 steve + * vpip_make_binary_const cannot free the string passed in to it. + * * Revision 1.90 2007/04/10 01:26:16 steve * variable arrays generated without writing a record for each word. * diff --git a/vvp/vpi_const.cc b/vvp/vpi_const.cc index a37343ef8..0b1a07107 100644 --- a/vvp/vpi_const.cc +++ b/vvp/vpi_const.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vpi_const.cc,v 1.37 2007/02/25 23:08:24 steve Exp $" +#ident "$Id: vpi_const.cc,v 1.38 2007/04/12 04:25:58 steve Exp $" #endif # include "vpi_priv.h" @@ -350,7 +350,7 @@ static const struct __vpirt vpip_binary_rt = { * ASCII string, with each letter a 4-value bit. The first character * may be an 's' if the vector is signed. */ -vpiHandle vpip_make_binary_const(unsigned wid, char*bits) +vpiHandle vpip_make_binary_const(unsigned wid, const char*bits) { struct __vpiBinaryConst*obj; @@ -387,7 +387,6 @@ vpiHandle vpip_make_binary_const(unsigned wid, char*bits) obj->bits.set_bit(idx, val); } - free(bits); return &(obj->base); } @@ -618,6 +617,9 @@ vpiHandle vpip_make_real_const(double value) /* * $Log: vpi_const.cc,v $ + * Revision 1.38 2007/04/12 04:25:58 steve + * vpip_make_binary_const cannot free the string passed in to it. + * * Revision 1.37 2007/02/25 23:08:24 steve * Process Verilog escape sequences much earlier. * diff --git a/vvp/vpi_priv.h b/vvp/vpi_priv.h index 475e8425a..fedd1ac0e 100644 --- a/vvp/vpi_priv.h +++ b/vvp/vpi_priv.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vpi_priv.h,v 1.73 2007/02/25 23:08:24 steve Exp $" +#ident "$Id: vpi_priv.h,v 1.74 2007/04/12 04:25:59 steve Exp $" #endif # include "vpi_user.h" @@ -308,7 +308,7 @@ struct __vpiBinaryConst { int sized_flag :1; }; -vpiHandle vpip_make_binary_const(unsigned wid, char*bits); +vpiHandle vpip_make_binary_const(unsigned wid, const char*bits); vpiHandle vpip_make_binary_param(char*name, const vvp_vector4_t&bits, bool signed_flag); @@ -451,6 +451,9 @@ extern char *need_result_buf(unsigned cnt, vpi_rbuf_t type); /* * $Log: vpi_priv.h,v $ + * Revision 1.74 2007/04/12 04:25:59 steve + * vpip_make_binary_const cannot free the string passed in to it. + * * Revision 1.73 2007/02/25 23:08:24 steve * Process Verilog escape sequences much earlier. *