From: malc <av1474@comtv.ru>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [6466] Fix qemu_malloc.
Date: Wed, 28 Jan 2009 17:16:57 +0000 [thread overview]
Message-ID: <E1LSE25-0007xJ-2b@cvs.savannah.gnu.org> (raw)
Revision: 6466
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6466
Author: malc
Date: 2009-01-28 17:16:56 +0000 (Wed, 28 Jan 2009)
Log Message:
-----------
Fix qemu_malloc.
make {linux,bsd}-user qemu_realloc handle ptr == NULL correctly.
spotted by malc.
Modified Paths:
--------------
trunk/bsd-user/mmap.c
trunk/linux-user/mmap.c
Modified: trunk/bsd-user/mmap.c
===================================================================
--- trunk/bsd-user/mmap.c 2009-01-27 19:15:31 UTC (rev 6465)
+++ trunk/bsd-user/mmap.c 2009-01-28 17:16:56 UTC (rev 6466)
@@ -127,6 +127,8 @@
size_t old_size, copy;
void *new_ptr;
+ if (!ptr)
+ return qemu_malloc(size);
old_size = *(size_t *)((char *)ptr - 16);
copy = old_size < size ? old_size : size;
new_ptr = qemu_malloc(size);
Modified: trunk/linux-user/mmap.c
===================================================================
--- trunk/linux-user/mmap.c 2009-01-27 19:15:31 UTC (rev 6465)
+++ trunk/linux-user/mmap.c 2009-01-28 17:16:56 UTC (rev 6466)
@@ -128,6 +128,8 @@
size_t old_size, copy;
void *new_ptr;
+ if (!ptr)
+ return qemu_malloc(size);
old_size = *(size_t *)((char *)ptr - 16);
copy = old_size < size ? old_size : size;
new_ptr = qemu_malloc(size);
next reply other threads:[~2009-01-28 17:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-28 17:16 malc [this message]
2009-01-28 18:44 ` [Qemu-devel] PATCH: qemu_mallocz(): minus one function and replace calloc() instead malloc() Pavel Vasilyev
2009-01-28 19:33 ` Lionel Landwerlin
2009-01-28 20:00 ` malc
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=E1LSE25-0007xJ-2b@cvs.savannah.gnu.org \
--to=av1474@comtv.ru \
--cc=qemu-devel@nongnu.org \
/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).