X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Thu, 5 Nov 2009 19:24:02 +0100
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: malloc overrides
Message-ID: <20091105182402.GU26344@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <4AF29EC2.2050808@users.sourceforge.net>  <4AF2D091.4030508@gmail.com>  <4AF30A85.5070208@users.sourceforge.net>  <416096c60911051022obc335ceu15dc7ee0e487cb66@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <416096c60911051022obc335ceu15dc7ee0e487cb66@mail.gmail.com>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Nov  5 18:22, Andy Koppe wrote:
> 2009/11/5 Yaakov (Cygwin/X):
> >>> extern void _exit (int);
> >>> extern char* strdup (const char*);
> >>
> >>   static int are_we_stuck = 1;
> >>>
> >>> char* malloc(unsigned n) {
> >>
> >>       are_we_stuck = 0;
> >>>
> >>>     return 0;
> >>> }
> >>>
> >>> int main(void) {
> >>>     strdup("yo");
> >>
> >>       _exit (are_we_stuck);
> >>>
> >>> }
> >>
> >>   FTFY.
> >
> > Funny, as I went to sleep last night I thought of just that solution. In
> > practice, though, while it doesn't hang, it doesn't give the correct answer
> > either.   As Corinna said, the malloc override needs to be functional, in
> > that it allocates memory which can then be free()d.  So this isn't going to
> > be quite so simple. :-(
> 
> Does the memory actually need to be freed?

Cygwin itself calls free, so the application implementation has to
provide both.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

