summaryrefslogtreecommitdiffstats
path: root/qemu-malloc.c
Commit message (Collapse)AuthorAgeFilesLines
* cow: stop using mmapChristoph Hellwig2010-06-151-5/+0Star
| | | | | | | | | | | | | We don't have an equivalent to mmap in the qemu block API, so read and write the bitmap directly. At least in the dumb implementation added in this patch this is a lot less efficient, but it means cow can also work on windows, and over nbd or curl. And it fixes qemu-iotests testcase 012 which did not work properly due to issues with read-only mmap access. In addition we can also get rid of the now unused get_mmap_addr function. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Use calloc in qemu_mallocz.Richard Henderson2010-05-281-4/+4
| | | | | | | | Avoids the memset if the allocator has gotten new zeroed storage from the operating system. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Simplify qemu_realloc()Markus Armbruster2010-02-231-5/+3Star
| | | | | | | No functional change. Bonus: looks just like qemu_malloc() now. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* Do not abort on qemu_malloc(0) in production buildsAnthony Liguori2009-12-121-6/+13
| | | | | | | | | | | | qemu_malloc() does not allow size=0 to be passed in and aborts on this behavior. Unfortunately, there is good reason to believe that within qemu, there are a number of, so far, undetected places that assume size=0 can be safely passed. Since we do not want to abort unnecessarily in production builds, return qemu_malloc(1) whenever the version file indicates that this is a production build. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Format per CODING_STYLEmalc2009-05-191-6/+10
| | | | Signed-off-by: malc <av1474@comtv.ru>
* Abort on attempts to allocate zero bytesmalc2009-05-191-2/+7
| | | | | | http://marc.info/?t=124267873300015&r=1&w=2 Signed-off-by: malc <av1474@comtv.ru>
* Fix qemu_realloc() (Kevin Wolf)aliguori2009-02-111-1/+4
| | | | | | | | | | For qemu_realloc with size == 0 a result of NULL is perfectly fine Signed-off-by: Kevin Wolf <kwolf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6615 c046a42c-6fe2-441c-8c8c-71466251a162
* Replace exit() in oom_check with abort()aliguori2009-02-061-1/+1
| | | | | | | | | | So that we can get a core dump with a stack trace. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6542 c046a42c-6fe2-441c-8c8c-71466251a162
* Terminate emulation on memory allocation failure (Avi Kivity)aliguori2009-02-051-6/+10
| | | | | | | | | | | | | | | | | Memory allocation failures are a very rare condition on virtual-memory hosts. They are also very difficult to handle correctly (especially in a hardware emulation context). Because of this, it is better to gracefully terminate emulation rather than executing untested or even unwritten recovery code paths. This patch changes the qemu memory allocation routines to terminate emulation if an allocation failure is encountered. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6526 c046a42c-6fe2-441c-8c8c-71466251a162
* Add qemu_strndup: qemu_strdup with length limit.balrog2008-11-091-1/+15
| | | | | | | | Also optimise qemu_strdup by using memcpy - using pstrcpy is usually suboptimal. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5653 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix error introduced by r5044blueswir12008-08-251-1/+1
| | | | | | | | | qemu_strdup() doesn't copy a last character because of off by one error. Signed-off-by: Gleb Natapov <gleb@qumranet.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5086 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix OpenBSD linker warningsblueswir12008-08-211-2/+3
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5044 c046a42c-6fe2-441c-8c8c-71466251a162
* Add qemu_realloc(), by Gerd Hoffmann.ths2008-08-061-0/+5
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4986 c046a42c-6fe2-441c-8c8c-71466251a162
* Prevent guest reusing host memory allocations.pbrook2008-06-091-0/+59
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4710 c046a42c-6fe2-441c-8c8c-71466251a162