[PATCH] vbscript: Implemented Asc(try 3)

Shuai Meng mengshuaicalendr at gmail.com
Wed Mar 4 12:49:57 CST 2015


Thanks for commenting.

2015-03-04 15:48 GMT+08:00 Nikolay Sivov <bunglehead at gmail.com>:

> On 04.03.2015 9:19, Shuai Meng wrote:
>
>> +    switch(V_VT(arg)) {
>> +    case VT_NULL:
>> +        return MAKE_VBSERROR(VBSE_ILLEGAL_NULL_USE);
>> +    case VT_BSTR:
>> +        bstr = V_BSTR(arg);
>> +        break;
>> +    default:
>> +        hres = to_string(arg, &bstr);
>> +        if(FAILED(hres))
>> +            return hres;
>> +    }
>> +
>> +    ret = bstr[0];
>> +    SysFreeString(bstr);
>> +
>> +    if(ret == 0)
>> +        return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL);
>> +    return return_short(res, ret);
>>
>
> This is wrong too. You can't always free it like that, please look
> carefully at where 'bstr' comes from.
>

Yeah, you are right, I am so anxious that  I didn't check it carefully.
'bstr' has two source, only when it comes from to_string(), it can be freed
with this way.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20150305/acc1cbe4/attachment.html>


More information about the wine-devel mailing list