Re: Debugging corrupted memoy
- From: "Sean G. McLaughlin" <sigma.zx@xxxxxxxxx>
- Date: Sat, 10 May 2008 20:27:13 GMT
static int do_stuff()The code is fundamentally wrong. You do not dereference the result of
{
obj_t res = *calloc((size_t)1, sizeof(obj_t));
// res is 0x000000..
obj_iterate(res);
// res is 0xffffff..
do_other_stuff(res->fied); <-- SIGSEGV
}
calloc() and assign it to an object, but assign it to a pointer to the
object.
obj_iterate() probably and do_other_stuff() definitely expect "res" to be a
pointer, when here it isn't.
.
- Follow-Ups:
- Re: Debugging corrupted memoy
- From: Julien Lafaye
- Re: Debugging corrupted memoy
- References:
- Debugging corrupted memoy
- From: Julien Lafaye
- Debugging corrupted memoy
- Prev by Date: Re: Debugging corrupted memoy
- Next by Date: Re: C popularity
- Previous by thread: Re: Debugging corrupted memoy
- Next by thread: Re: Debugging corrupted memoy
- Index(es):
Relevant Pages
|