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@[204.253.190.123]>
To: www-lib@w3.org

Hello,

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

HTHost_deleteAll();
   followed by
HTChannel_deleteAll();

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?

Thanks
Jeff

-- 
Received on Monday, 28 January 2002 16:44:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:40 GMT