mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
scm_gc_malloc: Handle zero-octet allocations.
* libguile/gc-malloc.c (scm_gc_malloc): Pass a non-zero size to `GC_MALLOC ()' when SIZE is zero. git-archimport-id: lcourtes@laas.fr--2006-libre/guile-core--boehm-gc--0--patch-2
This commit is contained in:
parent
4a4849dbe0
commit
ea4f8ea13f
1 changed files with 8 additions and 1 deletions
|
@ -209,7 +209,14 @@ scm_gc_malloc (size_t size, const char *what)
|
||||||
to write it the program is killed with signal 11. --hwn
|
to write it the program is killed with signal 11. --hwn
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void *ptr = GC_MALLOC (size);
|
void *ptr;
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
/* `GC_MALLOC ()' doesn't handle zero. */
|
||||||
|
size = sizeof (void *);
|
||||||
|
|
||||||
|
ptr = GC_MALLOC (size);
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue