Skip to content

Commit ca4561c

Browse files
committed
ext/com_dotnet: release the held IUnknown in com_get_active_object()
The cleanup block guarded on `unk` but released `obj`. On a successful GetActiveObject() this released the IDispatch proxy twice and leaked the IUnknown; on a QueryInterface failure `obj` is still NULL while `unk` is live, so the same line released NULL through a NULL vtable and crashed instead of throwing. Release `unk` so each interface pointer is released exactly once and the failure path no longer crashes. Closes GH-22378
1 parent df1250d commit ca4561c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ext/com_dotnet/com_com.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ PHP_FUNCTION(com_get_active_object)
321321
IDispatch_Release(obj);
322322
}
323323
if (unk) {
324-
IUnknown_Release(obj);
324+
IUnknown_Release(unk);
325325
}
326326
efree(module);
327327
}

0 commit comments

Comments
 (0)