9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: jmk@plan9.bell-labs.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] thornbird (another xscreensaver hack)
Date: Fri, 21 Jun 2002 19:02:06 -0400	[thread overview]
Message-ID: <b9f6e71885e65d570f85eeebbaf4c13d@plan9.bell-labs.com> (raw)

On Fri Jun 21 18:45:41 EDT 2002, andrey@lanl.gov wrote:

> > Reminder: malloc does not return zeroed storage.
> > Either zero it on return or use mallocz.
>
> it's not my code -- i'm simply fixing the X-related stuff, adding
> main(), drawing and that's all...  haven't really debugged the actual
> xscreensaver hack...
>
> unless malloc() behaves differently than the linux/unix ones i simply
> didn't think there may be a problem -- it works there, why shouldn't
> it here?

"it works there, why shouldn't it here?" - Because it's different.
The crash trace which someone posted was because Plan 9 malloc does
not return zeroed memory and the code does a check to see whether
pointers stored in that memory are NULL or not, and tries to free
the non-NULL ones. I don't believe there is any requirement in the
C standard (although I haven't checked) for the returned memory to
be zeroed. A check of the 2 non-Plan 9 systems I have handy (Linux,
Irix) show one will zero the memory and one won't.


             reply	other threads:[~2002-06-21 23:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-21 23:02 jmk [this message]
2002-06-22  1:21 ` Mike Haertel
  -- strict thread matches above, loose matches on Subject: below --
2002-06-24  5:40 David Gordon Hogan
2002-06-24  0:51 okamoto
2002-06-22 12:39 Tiit Lankots
2002-06-22  1:45 jmk
2002-06-21 22:57 David Gordon Hogan
2002-06-22  7:42 ` Fariborz Tavakkolian
2002-06-21 22:41 andrey mirtchovski
2002-06-21 22:37 jmk
2002-06-21 22:21 andrey mirtchovski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b9f6e71885e65d570f85eeebbaf4c13d@plan9.bell-labs.com \
    --to=jmk@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).