This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: malloc overrides


On 05/11/2009 07:18, Dave Korn wrote:
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. :-(



Yaakov


--
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]