W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2002

Incorrect order in HTLibTerminate of HTLib.c?

From: Jeff Adams <jeffa@coursewave.com>
Date: Mon, 28 Jan 2002 15:46:20 -0600
Message-Id: <a05100301b87b73ea598c@[]>
To: www-lib@w3.org


In HTLibTerminate(void) of HTLib.c a number of cleanup/delete functions
are called, in particular,

   followed by

but I am wondering whether in fact
HTChannel_deleteAll() should be called BEFORE HTHost_deleteAll()

the reason I ask this is that I just debugged a situation
in my app in which if the user requests a URL to a server
that either isn't up or gets shutdown while in use
a normal and proper "Failed to connect" error occurs.

However, on shutdown of the app and within
the call to HTLibTerminate(void), I can get an unmapped memory
exception which is traced to the delete code in HTChannel_deleteAll()
requesting the use of the host associated with an apparently
still alive read channel which ends up
calling HTHost_getReadNet(HTHost * host) in HTHost.c

Seeing that the code currently does a HTHost_deleteAll before calling
HTChannel_deleteAll I reversed the calling of these two functions
and it eliminated the unmapped exception.

When HTHost_deleteAll() was added to HTLibTerminate do you think
someone just did not think that there are instances when
open channels might still need the host info around on their delete.
This seems to be the case I have found...

Anyone else ever see this or know of any problems with
reversing these two calls?


Received on Monday, 28 January 2002 16:44:05 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:33:54 UTC