From b7b2d710b1559a5b2640deb40d3dddfe428ecdb4 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 5 Oct 2011 17:00:08 -0700 Subject: [PATCH] V0.9: Free the iterator if there are extra arguments. To avoid extra memory usage on error free the iterator if there are extra arguments. --- vpi/v2005_math.c | 4 +++- vpi/va_math.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/vpi/v2005_math.c b/vpi/v2005_math.c index 4b5f9ce7e..1d36e3ae4 100644 --- a/vpi/v2005_math.c +++ b/vpi/v2005_math.c @@ -2,7 +2,7 @@ * Verilog-2005 math library for Icarus Verilog * http://www.icarus.com/eda/verilog/ * - * Copyright (C) 2007-2010 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2007-2011 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -196,6 +196,7 @@ static PLI_INT32 va_single_argument_compiletf(PLI_BYTE8 *ud) arg = vpi_scan(argv); if (arg != 0) { va_error_message(callh, "%s takes only one argument.\n", name); + vpi_free_object(argv); } /* Get the function that is to be used by the calltf routine. */ @@ -285,6 +286,7 @@ static PLI_INT32 va_double_argument_compiletf(PLI_BYTE8 *ud) arg = vpi_scan(argv); if (arg != 0) { va_error_message(callh, "%s takes only two arguments.\n", name); + vpi_free_object(argv); } /* Get the function that is to be used by the calltf routine. */ diff --git a/vpi/va_math.c b/vpi/va_math.c index 177c9fe3b..f75682c66 100644 --- a/vpi/va_math.c +++ b/vpi/va_math.c @@ -2,7 +2,7 @@ * Verilog-A math library for Icarus Verilog * http://www.icarus.com/eda/verilog/ * - * Copyright (C) 2007-2010 Cary R. (cygcary@yahoo.com) + * Copyright (C) 2007-2011 Cary R. (cygcary@yahoo.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -223,6 +223,7 @@ static PLI_INT32 va_single_argument_compiletf(PLI_BYTE8 *ud) arg = vpi_scan(argv); if (arg != 0) { va_error_message(callh, "%s takes only one argument.\n", name); + vpi_free_object(argv); } /* Get the function that is to be used by the calltf routine. */ @@ -312,6 +313,7 @@ static PLI_INT32 va_double_argument_compiletf(PLI_BYTE8 *ud) arg = vpi_scan(argv); if (arg != 0) { va_error_message(callh, "%s takes only two arguments.\n", name); + vpi_free_object(argv); } /* Get the function that is to be used by the calltf routine. */