changeset 5897:8545ec4d6e65

[project @ 2006-07-19 16:51:50 by jwe]
author jwe
date Wed, 19 Jul 2006 16:52:12 +0000
parents fc22530e985b
children da843f35775c
files src/ChangeLog src/ov-base.cc
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2006-07-19  John W. Eaton  <jwe@octave.org>
+
+	* ov-base.cc (octave_base_value::numeric_assign):
+	Avoid memory leak when converting LHS.
+
 2006-07-18  John W. Eaton  <jwe@octave.org>
 
 	* ov.h (octave_value::is_int8_type, octave_value::is_int16_type,
--- a/src/ov-base.cc
+++ b/src/ov-base.cc
@@ -972,14 +972,15 @@
 	  octave_base_value::type_conv_fcn cf_this
 	    = numeric_conversion_function ();
 
-	  octave_base_value *tmp_lhs = this;
+	  count++;
+	  octave_value tmp_lhs = octave_value (this);
 
 	  if (cf_this)
 	    {
 	      octave_base_value *tmp = cf_this (*this);
 
 	      if (tmp)
-		tmp_lhs = tmp;
+		tmp_lhs = octave_value (tmp);
 	      else
 		{
 		  gripe_assign_conversion_failed (type_name (),
@@ -990,7 +991,7 @@
 
 	  if (cf_this || cf_rhs)
 	    {
-	      retval = tmp_lhs->subsasgn (type, idx, tmp_rhs);
+	      retval = tmp_lhs.subsasgn (type, idx, tmp_rhs);
 
 	      done = (! error_state);
 	    }