Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19023 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84639 invoked by uid 1010); 16 Sep 2005 02:52:51 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 84624 invoked from network); 16 Sep 2005 02:52:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Sep 2005 02:52:51 -0000 X-Host-Fingerprint: 69.12.155.130 69-12-155-130.dsl.static.sonic.net Linux 2.4/2.6 Received: from ([69.12.155.130:3735] helo=pigeon.alphaweb.net) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id D9/4B-43379-3833A234 for ; Thu, 15 Sep 2005 22:52:51 -0400 Received: from localhost ([127.0.0.1] helo=lighthammer) by pigeon.alphaweb.net with smtp (Exim 4.10) id 1EG5fs-00049Z-00; Thu, 15 Sep 2005 19:10:00 -0700 Message-ID: <001901c5ba69$b6573c70$6c051fac@lighthammer> To: "RG" Cc: References: <29.87.41173.A9FD9234@pb1.pair.com> <00f301c5ba49$455192c0$5c8be5a9@ohr.berkeley.edu> <5A.79.43379.A1E1A234@pb1.pair.com> Date: Thu, 15 Sep 2005 19:09:57 -0700 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Subject: Re: Segfault From: pollita@php.net ("Sara Golemon") > 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