]> granicus.if.org Git - yasm/commitdiff
Plug memory leak in floatnum_new().
authorPeter Johnson <peter@tortall.net>
Mon, 3 Dec 2001 00:55:00 +0000 (00:55 -0000)
committerPeter Johnson <peter@tortall.net>
Mon, 3 Dec 2001 00:55:00 +0000 (00:55 -0000)
svn path=/trunk/yasm/; revision=383

libyasm/floatnum.c
src/floatnum.c

index d9006349b3dda38c7f4c56a89a63534b258c44b5..5faef0dfb6c01f36c48596d51ae51fa2460faa4f 100644 (file)
@@ -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. */
index d9006349b3dda38c7f4c56a89a63534b258c44b5..5faef0dfb6c01f36c48596d51ae51fa2460faa4f 100644 (file)
@@ -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. */