qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, pbonzini@redhat.com, stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v2 1/4] w32: Make qemu_vfree() accept NULL like the POSIX implementation
Date: Tue, 15 Jan 2013 15:29:07 +0100	[thread overview]
Message-ID: <1358260150-9760-2-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1358260150-9760-1-git-send-email-armbru@redhat.com>

On POSIX, qemu_vfree() accepts NULL, because it's merely wrapper
around free().  As far as I can tell, the Windows implementation
doesn't.  Breeds bugs that bite only under Windows.

Make the Windows implementation behave like the POSIX implementation.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 util/oslib-win32.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index e7e283e..640194c 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -71,7 +71,9 @@ void *qemu_vmalloc(size_t size)
 void qemu_vfree(void *ptr)
 {
     trace_qemu_vfree(ptr);
-    VirtualFree(ptr, 0, MEM_RELEASE);
+    if (ptr) {
+        VirtualFree(ptr, 0, MEM_RELEASE);
+    }
 }
 
 /* FIXME: add proper locking */
-- 
1.7.11.7

  reply	other threads:[~2013-01-15 14:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-15 14:29 [Qemu-devel] [PATCH v2 0/4] Fixes around qemu_vfree() Markus Armbruster
2013-01-15 14:29 ` Markus Armbruster [this message]
2013-01-15 14:29 ` [Qemu-devel] [PATCH v2 2/4] scsi-disk: qemu_vfree(NULL) is fine, simplify Markus Armbruster
2013-01-15 14:29 ` [Qemu-devel] [PATCH v2 3/4] win32-aio: Fix how win32_aio_process_completion() frees buffer Markus Armbruster
2013-01-15 14:29 ` [Qemu-devel] [PATCH v2 4/4] block: Fix how mirror_run() frees its buffer Markus Armbruster
2013-01-15 14:35 ` [Qemu-devel] [PATCH v2 0/4] Fixes around qemu_vfree() Kevin Wolf
2013-01-15 16:29   ` Stefan Hajnoczi

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=1358260150-9760-2-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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 NNTP newsgroup(s).