Mail Archives: cygwin/2005/03/16/11:30:53
On Tue, Mar 15, 2005 at 08:20:28PM -0800, David Rothenberger wrote:
>I've been having some problems with autossh crashing with 1.5.13 and
>later snapshots. These problems did not occur with 1.5.12. (The problem
>may be related to the one reported by Andrew Schulman in
><http://sourceware.org/ml/cygwin/2005-03/msg00410.html>.)
I managed to duplicate this but, in duplicating the problem, I was
surprised to find out that my debugging symbols were all gone when I
went to investigate the problem in gdb.
The reason the symbols were gone is that I was using the released
version of 1.5.13. Doh, on me but this indicates that is not just a
snapshot problem.
Once I installed a CVS-version of cygwin, I quickly discovered that, as
Dave Korn unsurprisingly and correctly diagnosed, this is a heap
corruption problem. I'd noted that the stack trace which was previously
provided looked "funny" and I couldn't figure out how cygwin could get
in the state indicated by the stack trace. Well, heap corruption is what
caused the funniness.
The problem is that autossh is freeing the return value of
gethostbyname(). I can't find any reference which says that is a
acceptable thing to do. It certainly screws up cygwin, and I can't
think of any way to avoid having it screw up cygwin. Maybe it won't
screw up other systems since they may not malloc the return value of
gethostbyname. I dunno.
I haven't run an exhaustive test, but the patch below seems to fix this
problem.
Could the autossh maintainer look into getting this applied upstream?
cgf
--- autossh.c.orig 2004-08-07 00:07:11.000000000 -0400
+++ autossh.c 2005-03-16 11:17:43.000000000 -0500
@@ -1034,15 +1034,14 @@
if ((h = gethostbyname(host)) == NULL)
xerrlog(LOG_ERR, "%s: %s", host, hstrerror(h_errno));
resp->sin_family = h->h_addrtype;
resp->sin_port = htons(atoi(port));
resp->sin_addr = *((struct in_addr *) h->h_addr_list[0]);
- free(h);
return;
}
/*
* Open connection we're writing to.
*/
int
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -