Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-07

TProcess leaks handles + patch (win32)

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Vincent Snijders

Hi,

The TProcess component doesn't close the process handle and the thread handle in the ProcessInformation record, that is created by CreateProcess. In win32 thpse handles should be closed when you don't need them anymore. From MSDN:
<--begin snippet>
lpProcessInformation
[out] Pointer to a PROCESS_INFORMATION structure that receives identification information about the new process. Handles in PROCESS_INFORMATION must be closed with CloseHandle when they are no longer needed. <--end snippet>

Attached patch fixes this problem.

Regards,
Vincent.

--Multipart=_Fri__30_Jul_2004_09_30_58_+0200_4u0xtzexIqjQmtpV Content-Type: application/zip;
name="process.zip"
Content-Disposition: attachment;
filename="process.zip"
Content-Transfer-Encoding: base64

UEsDBBQAAAAIAIFJ/jDclnqS8wEAALkEAAALAAAAcHJvY2Vzcy50eHSlUl1vmzAUfS4S/+E+7KET 4TNpRcg2ZUvLxp6ipNo7CZdgiRhkm7TT1P8+Gzuk1bJm0iwkY/vce88592a0wKcEynbrht7Um/jl tvYJ3fota7bIude2tvXx/5dtrRZrKEmNCfjpcuEvfqx9WfVMvdHBthgKRvBA6A6Y3DhpKIReOLWt gpQluB24TJ3hJU3Xdd8UcjWGFDcQBcEEgjgJoySKwA3kutK5Hce5kCCA711tMtwmNzJJqDPY1nwO bjgZj27BUdsU5nPbArXS5arPsGSkYUT8hAQeluzV1ewIXYucia7NaNko2IvjEdJHFh1DSBniWjDM 91w+Or/ekbLAEh4JHUfP8uI1elE3HE3ZbzktajRRSKWnz0cCHd0K5TZ8RXH/RIRkIDouuWRU4A7Z 7BxQ51OE9d9Z0KqjVDU0gS9NU2NOZ9q0aDJVpkU30cm0rIScc7KjWMB1+lBJkcVnIWdi0wnk70FU SOGO8FZqOgfQBNJ7eiCsoXukwlNumeuLvv2LVxmtULZOErxDLljT91C+q80Ii6NeWByPwviozCAG 4J/l26Flxynx/sJngztCe8KPRFRyzjRCTQvb573xRQMnFAAp4boysA+fAm2keTOydf4BpawcQrXP GnEhXENNtFbrmO1koyMtGGZkUPvG5MnPyPkNUEsBAhQAFAAAAAgAgUn+MNyWepLzAQAAuQQAAAsA AAAAAAAAAQAgAAAAAAAAAHByb2Nlc3MudHh0UEsFBgAAAAABAAEAOQAAABwCAAAAAA==

--Multipart=_Fri__30_Jul_2004_09_30_58_+0200_4u0xtzexIqjQmtpV--

Michael Van Canneyt
to Vincent Snijders
Vincent Snijders wrote 11 lines
Hi, The TProcess component doesn't close the process handle and the thread handle in the ProcessInformation record, that is created by CreateProcess. In win32 thpse handles should be closed when you don't need them anymore. >From MSDN: <--begin snippet> lpProcessInformation [out] Pointer to a PROCESS_INFORMATION structure that receives identification information about the new process. Handles in PROCESS_INFORMATION must be closed with CloseHandle when they are no longer needed. <--end snippet> Attached patch fixes this problem.

Applied, thanks.

Michael.