That's not where it segfaults. The function works perfectly once. If I
attempt to exit /
die or call that function again, it segfaults.
However, I have noticed that if I do not use ZEND_REGISTER_RESOURCE the
program no longer segfaults.
I didn't say that's where it segfaults, I said that's where your problem is.
Just because you can write to a particular memory location once doesn't
change the fact that the memory in question doesn't belong to your new_sock
struct. Your code is tacking a relevant piece of data and just throwing it
out into the middle of the memory pool hoping it doesn't hit some swimmer in
the head in the process. Figure out why you can't malloc the struct first.
That one is a very clear, unambiguous crash-causing bug.
And sorry for the comments, someone people don't write the final version
of
a program on their first try.
I'd doubt anyone does. Writing well-indented code helps debugging though
(both for you and for people you ask to take a second look). Right now it's
all just cluttered. As my momma always told me, "If you'd clean up your
room once in awhile, you might find what you're looking for."
And if my reply sounded harsh, it might have to do with the fact that you
ignored my suggestions on how to implement zend_fetch_list_dtor_id().
-Sara
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php