This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: autossh crash with 20050314 and earlier cygwin1.dll [autossh maintainer please note]
> Generally speaking, it is whoever mallocs memory that has the
> responsibility for freeing it. If your app mallocs it, your app should free
> it; if the library mallocs it, the library should free it.
>
> In some cases, the ownership of a bit of memory (or any other resource)
> may be transferred; in those cases, the responsibility for deallocation is
> transferred along with the ownership.
>
> But that does not happen without a clear statement in the interface /
> documentation. A function that returns a pointer to some data in memory is
> giving you just that, and no more: a pointer to some data in memory. Only
> if the specification of the function explicitly states that the caller gets
> ownership of the resource should your code assume it has any rights over it
> whatsover. If the interface doesn't say so, then you should assume nothing
> - not just that you can't free (...) it, but you should also assume that you
> aren't allowed to overwrite the memory block or change its contents or do
> anything other than examine and/or copy it.
OK, thank you. This seems clear.
I've sent the patch for this problem upstream, and the corrected Cygwin
package will be out shortly.
Andrew.
--
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/