From 69c42d7aaaba02548c328e9952283edeb732c18a Mon Sep 17 00:00:00 2001
From: Peter Johnson <peter@tortall.net>
Date: Mon, 3 Dec 2001 00:55:00 +0000
Subject: [PATCH] Plug memory leak in floatnum_new().

svn path=/trunk/yasm/; revision=383
---
 libyasm/floatnum.c | 9 +++++----
 src/floatnum.c     | 9 +++++----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/libyasm/floatnum.c b/libyasm/floatnum.c
index d9006349..5faef0df 100644
--- a/libyasm/floatnum.c
+++ b/libyasm/floatnum.c
@@ -421,16 +421,17 @@ floatnum_new(const char *str)
 	dec_exponent += dec_exp_add;
     }
 
+    /* Free calculation variables. */
+    BitVector_Destroy(operand[1]);
+    BitVector_Destroy(operand[0]);
+
     /* Normalize the number, checking for 0 first. */
     if (BitVector_is_empty(flt->mantissa)) {
 	/* Mantissa is 0, zero exponent too. */
 	flt->exponent = 0;
 	/* Set zero flag so output functions don't see 0 value as underflow. */
 	flt->flags |= FLAG_ISZERO;
-	/* Free calculation variables and return. */
-	BitVector_Destroy(operand[1]);
-	BitVector_Destroy(operand[0]);
-
+	/* Return 0 value. */
 	return flt;
     }
     /* Exponent if already norm. */
diff --git a/src/floatnum.c b/src/floatnum.c
index d9006349..5faef0df 100644
--- a/src/floatnum.c
+++ b/src/floatnum.c
@@ -421,16 +421,17 @@ floatnum_new(const char *str)
 	dec_exponent += dec_exp_add;
     }
 
+    /* Free calculation variables. */
+    BitVector_Destroy(operand[1]);
+    BitVector_Destroy(operand[0]);
+
     /* Normalize the number, checking for 0 first. */
     if (BitVector_is_empty(flt->mantissa)) {
 	/* Mantissa is 0, zero exponent too. */
 	flt->exponent = 0;
 	/* Set zero flag so output functions don't see 0 value as underflow. */
 	flt->flags |= FLAG_ISZERO;
-	/* Free calculation variables and return. */
-	BitVector_Destroy(operand[1]);
-	BitVector_Destroy(operand[0]);
-
+	/* Return 0 value. */
 	return flt;
     }
     /* Exponent if already norm. */
-- 
2.40.0