Re: GetNetworkParams leak ?(WAS: \\device\tcp handle leak)
- From: Stefan Kuhr <kustt110@xxxxxx>
- Date: Thu, 30 Jun 2005 16:16:43 +0200
Hi Tom,
Tom Goff wrote:
Hi Shmul,
I have found that your leak is related to dynamically loading the DLL. The following code does not leak handles:
static void test_get_networks_params(int N) { for (int i=0; i<N; ++i ) { FIXED_INFO *fi = (FIXED_INFO*)alloca (sizeof(*fi)); DWORD size = sizeof (*fi);
GetNetworkParams(fi, &size); } }
Completely off-topic but I thought it might hurt you one day if nobody tells you: You should never ever call alloca in a loop, as this might cause your stack to be blown. In the code above it will probably much better if you just create one FIXED_INFO on the stack that you use for every cycle in the for-loop.
As a side note: If you run this code through VS2005 with prefast enabled, it will immediately spot this error.
HTH,
-- Stefan Kuhr
"Lesen schadet der Dummheit" .
- Follow-Ups:
- References:
- \\device\tcp handle leak
- From: shmul
- Re: \\device\tcp handle leak
- From: Arkady Frenkel
- Re: \\device\tcp handle leak
- From: shmul
- Re: \\device\tcp handle leak
- From: Arkady Frenkel
- GetNetworkParams leak ?(WAS: \\device\tcp handle leak)
- From: shmul
- Re: GetNetworkParams leak ?(WAS: \\device\tcp handle leak)
- From: Arkady Frenkel
- Re: GetNetworkParams leak ?(WAS: \\device\tcp handle leak)
- From: shmul
- Re: GetNetworkParams leak ?(WAS: \\device\tcp handle leak)
- From: Tom Goff
- \\device\tcp handle leak
- Prev by Date: Re: IsUserAnAdmin not find into shell32.dll version 5
- Next by Date: Re: Ways to analyze crash dump file
- Previous by thread: Re: GetNetworkParams leak ?(WAS: \\device\tcp handle leak)
- Next by thread: Re: GetNetworkParams leak ?(WAS: \\device\tcp handle leak)
- Index(es):
Relevant Pages
|