<div dir="ltr">Thanks for commenting.<br><div class="gmail_extra"><br><div class="gmail_quote">2015-03-04 15:48 GMT+08:00 Nikolay Sivov <span dir="ltr"><<a href="mailto:bunglehead@gmail.com" target="_blank">bunglehead@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 04.03.2015 9:19, Shuai Meng wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+    switch(V_VT(arg)) {<br>
+    case VT_NULL:<br>
+        return MAKE_VBSERROR(VBSE_ILLEGAL_<u></u>NULL_USE);<br>
+    case VT_BSTR:<br>
+        bstr = V_BSTR(arg);<br>
+        break;<br>
+    default:<br>
+        hres = to_string(arg, &bstr);<br>
+        if(FAILED(hres))<br>
+            return hres;<br>
+    }<br>
+<br>
+    ret = bstr[0];<br>
+    SysFreeString(bstr);<br>
+<br>
+    if(ret == 0)<br>
+        return MAKE_VBSERROR(VBSE_ILLEGAL_<u></u>FUNC_CALL);<br>
+    return return_short(res, ret);<br>
</blockquote>
<br>
This is wrong too. You can't always free it like that, please look carefully at where 'bstr' comes from.<br></blockquote><div><br></div><div>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.</div></div><br></div></div>