In my code I had this line:
f(t->a, t->b, destroy(t));
Where f
is a function, t
is a pointer to a struct and destroy
is a function which frees the pointer t and returns NULL
. The code compiled and run successfully on some compilers (cc, gcc, clang on OS X and clang on Linux) as I expected - t->a
and t->b
were evaluated before freeing t
. However, when compiling with cc/gcc on Linux I got a segmentation fault, as if I was trying to dereference null pointer. What causes that?
Thanks!