Modify ↓
Opened on Sep 7, 2014 at 3:56:03 PM
#2884 closed Bug (Wont Fix)
AutoIt tries to call COM VariantClear() on uninitialized memory
| Reported by: | Owned by: | ||
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.13.19 | Severity: | None |
| Keywords: | COM crash | Cc: |
Description
A COM OLE query to an MS SQL Server database results in a crash in AutoIt's wrapper that calls oleaut32.dll VariantClear(). The attached file recreates the bug.
Attachments (1)
Change History (3)
by , on Sep 7, 2014 at 4:00:23 PM
| Attachment: | comtest.zip added |
|---|
comment:1 by , on Jul 27, 2015 at 10:06:47 PM
this is the same problem like here:
https://www.autoitscript.com/trac/autoit/ticket/2887
As you can see here:
Func _ExecStatements(Const $oConn, Const $sStatements, Const $bIgnoreInvalidObjRef = False)
_WriteDiag("Info", "Executing: "&@CRLF&$sStatements)
$COMstatusMessage = "attempting to execute query"
If $bIgnoreInvalidObjRef Then
$g_oErrObj = ObjEvent("AutoIt.Error", "_COMwarningHandlerWrapper")
EndIf
Local $oRecordSet = _SQLQuery($oConn, $sStatements)
If $bIgnoreInvalidObjRef Then
$g_oErrObj = ObjEvent("AutoIt.Error", "_COMerrorHandler")
EndIf
Return $oRecordSet
EndFunc
You are setting $g_oErrObj few times.
The workaround is to set:
$g_oErrObj = Null
Func _ExecStatements(Const $oConn, Const $sStatements, Const $bIgnoreInvalidObjRef = False)
_WriteDiag("Info", "Executing: "&@CRLF&$sStatements)
$COMstatusMessage = "attempting to execute query"
If $bIgnoreInvalidObjRef Then
$g_oErrObj = Null
$g_oErrObj = ObjEvent("AutoIt.Error", "_COMwarningHandlerWrapper")
EndIf
Local $oRecordSet = _SQLQuery($oConn, $sStatements)
If $bIgnoreInvalidObjRef Then
$g_oErrObj = Null
$g_oErrObj = ObjEvent("AutoIt.Error", "_COMerrorHandler")
EndIf
Return $oRecordSet
EndFunc
comment:2 by , on Jul 25, 2020 at 9:23:59 AM
| Resolution: | → Wont Fix |
|---|---|
| Status: | new → closed |
no update so I close it
Note:
See TracTickets
for help on using tickets.

Connect to an MS SQL Server to test COM