public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
From: Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>
To: jakub@redhat.com
Cc: libc-hacker@sources.redhat.com
Subject: Re: [PATCH] Fix malloc
Date: Wed, 13 Mar 2002 04:11:00 -0000	[thread overview]
Message-ID: <20020313121151.10960.qmail@md.dent.med.uni-muenchen.de> (raw)
In-Reply-To: <20020313124654.W2204@sunsite.ms.mff.cuni.cz> (message from Jakub Jelinek on Wed, 13 Mar 2002 12:46:54 +0100)

Hi,

> The issue is that if MORECORE_FAILURE != MMAP_FAILED, then
> if brk fails and mmap fails too, it would leave brk set to MMAP_FAILED
> and so code below would consider it as if brk was successfully set.

Clearly you're right.  I'd rather not change 'brk' at all though,
like below:

2002-03-13  Wolfram Gloger  <wg@malloc.de>

	* malloc/malloc.c (sYSMALLOc): Don't change brk if mmap
	failed.

--- malloc.c	2002/02/15 09:30:28	1.6
+++ malloc.c	2002/03/13 12:06:55
@@ -2824,11 +2824,12 @@
     /* Don't try if size wraps around 0 */
     if ((unsigned long)(size) > (unsigned long)(nb)) {
 
-      brk = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE));
+      char *mbrk = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE));
 
-      if (brk != MAP_FAILED) {
+      if (mbrk != MAP_FAILED) {
 
         /* We do not need, and cannot use, another sbrk call to find end */
+        brk = mbrk;
         snd_brk = brk + size;
 
         /*

  reply	other threads:[~2002-03-13 12:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-13  3:47 Jakub Jelinek
2002-03-13  4:11 ` Wolfram Gloger [this message]
2002-03-13 15:23   ` Ulrich Drepper

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=20020313121151.10960.qmail@md.dent.med.uni-muenchen.de \
    --to=wmglo@dent.med.uni-muenchen.de \
    --cc=jakub@redhat.com \
    --cc=libc-hacker@sources.redhat.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).