[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
RE: connection.c
> I was up late last night, and am probably not thinking
> clearly, but I just
> ran into a
> problem in connection.c. In connections_destroy(), in the loop that
> destroys the
> mutexes, it also frees &connections[i]. Since connections
> is an array of
> connection
> structures, not an array of connection pointers, the first
> time through,
> this frees
> the whole array. All subsequent passes through this loop are
> then accessing
> freed
> memory. Is this correct, or am I just in a haze?
>
I found this too when I was testing on NT. I put some #ifndef WIN32 #endif around it, since I'm not sure how it bhaves on Unix. For sure, the NT memory manager was not to happy with it.
Personally, I doon't believe its very nice, since connections is a pointer to an array of Connections, not a pointer to an array of pointers to Connections.
I guess the latter may have been intended at some stage.
Paul Higgs