Tcl Source Code

Check-in [1a881ee299]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Plugged a memory leak in double->string conversion. [Bug 3386975]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: 1a881ee299cb6c2f9c5a933e28713a66ca3c0901
User & Date: kbk 2011-08-06 03:14:37
Context
2011-08-09
06:57
[Bug 3388350] mingw64 compiler warnings check-in: d4938bf2ce user: jan.nijtmans tags: core-8-5-branch
2011-08-06
03:19
Plugged a memory leak in double->string conversion. [Bug 3386975] check-in: c9b7bd387f user: kbk tags: trunk
03:14
Plugged a memory leak in double->string conversion. [Bug 3386975] check-in: 1a881ee299 user: kbk tags: core-8-5-branch
2011-07-28
14:42
Update to Olson's tzdata2011h check-in: 6e66b1bc32 user: dgp tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.






1
2
3
4
5
6
7





2011-07-28  Don Porter  <[email protected]>

	* library/tzdata/Asia/Anadyr: Update to Olson's tzdata2011h
	* library/tzdata/Asia/Irkutsk:
	* library/tzdata/Asia/Kamchatka:
	* library/tzdata/Asia/Krasnoyarsk:
	* library/tzdata/Asia/Magadan:
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
2011-08-05:  Kevin B. Kenny  <[email protected]>

	* generic/tclStrToD.c: Plugged a memory leak in double->string
	conversion. [Bug 3386975]

2011-07-28  Don Porter  <[email protected]>

	* library/tzdata/Asia/Anadyr: Update to Olson's tzdata2011h
	* library/tzdata/Asia/Irkutsk:
	* library/tzdata/Asia/Kamchatka:
	* library/tzdata/Asia/Krasnoyarsk:
	* library/tzdata/Asia/Magadan:

Changes to generic/tclStrToD.c.

3851
3852
3853
3854
3855
3856
3857

3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
    int i, j;
    
    /*
     * b = bw * 2**b2 * 5**b5
     * S = 2**s2 * 5*s5
     */


    TclBNInitBignumFromWideUInt(&b, bw);
    mp_mul_2d(&b, b2, &b);
    mp_init_set_int(&S, 1);
    MulPow5(&S, s5, &S); mp_mul_2d(&S, s2, &S);

    /*
     * Handle the case where we guess the position of the decimal point 
     * wrong. 
     */
    
    if (mp_cmp_mag(&b, &S) == MP_LT) {
	mp_mul_d(&b, 10, &b);
	ilim =ilim1;
	--k;
    }
    mp_init(&temp);

    /* Convert the leading digit */

    mp_init(&dig);
    i = 0;
    mp_div(&b, &S, &dig, &b);
    if (dig.used > 1 || dig.dp[0] >= 10) {
	Tcl_Panic("wrong digit!");
    }
    digit = dig.dp[0];








>















<



<







3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873

3874
3875
3876

3877
3878
3879
3880
3881
3882
3883
    int i, j;
    
    /*
     * b = bw * 2**b2 * 5**b5
     * S = 2**s2 * 5*s5
     */

    mp_init_multi(&temp, &dig, NULL);
    TclBNInitBignumFromWideUInt(&b, bw);
    mp_mul_2d(&b, b2, &b);
    mp_init_set_int(&S, 1);
    MulPow5(&S, s5, &S); mp_mul_2d(&S, s2, &S);

    /*
     * Handle the case where we guess the position of the decimal point 
     * wrong. 
     */
    
    if (mp_cmp_mag(&b, &S) == MP_LT) {
	mp_mul_d(&b, 10, &b);
	ilim =ilim1;
	--k;
    }


    /* Convert the leading digit */


    i = 0;
    mp_div(&b, &S, &dig, &b);
    if (dig.used > 1 || dig.dp[0] >= 10) {
	Tcl_Panic("wrong digit!");
    }
    digit = dig.dp[0];

3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
	    }
	}
    }
    /* 
     * Endgame - store the location of the decimal point and the end of the
     * string.
     */
    mp_clear_multi(&b, &temp, NULL);
    *s = '\0';
    *decpt = k;
    if (endPtr) {
	*endPtr = s;
    }
    return retval;








|







3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
	    }
	}
    }
    /* 
     * Endgame - store the location of the decimal point and the end of the
     * string.
     */
    mp_clear_multi(&b, &S, &temp, &dig, NULL);
    *s = '\0';
    *decpt = k;
    if (endPtr) {
	*endPtr = s;
    }
    return retval;