Re: Debugging corrupted memoy
- From: Willem <willem@xxxxxxxx>
- Date: Sun, 11 May 2008 07:46:36 +0000 (UTC)
Julien wrote:
) static int do_stuff()
) {
) 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
) }
Others have pointed out the problems with calloc().
Here's another two questions:
Is the prototype for obj_iterate in scope (and has it been compiled
for 64-bit pointer architecture) ?
What does obj_iterate return as value and type ?
SaSW, Willem
--
Disclaimer: I am in no way responsible for any of the statements
made in the above text. For all I know I might be
drugged or something..
No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT
.
- References:
- Debugging corrupted memoy
- From: Julien Lafaye
- Debugging corrupted memoy
- Prev by Date: Re: C popularity
- Next by Date: Re: Memory location for local C variables
- Previous by thread: Re: Debugging corrupted memoy
- Next by thread: Pass-by-reference to nested function?
- Index(es):
Relevant Pages
|