tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] [PATCH] tcc_malloc fix


From: Rogelio M. Serrano Jr.
Subject: [Tinycc-devel] [PATCH] tcc_malloc fix
Date: Sun, 22 Sep 2002 14:38:53 +0800 (PHT)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

This is a patch to fix the "memory full" failure when using the uclibc
compiled tcc. This is due to the difference in behaviour between the glibc
and uclibc malloc. Uclibc returns a NULL when you call malloc with size =
0 while glibc does not. Allocating zero bytes should fail right? Glibc is
just strange.

- --- tcc-0.9.12.orig/tcc.c     2002-09-22 14:28:24.000000000 +0800
+++ tcc-0.9.12/tcc.c    2002-09-22 14:26:43.000000000 +0800
@@ -765,7 +765,7 @@
 {
     void *ptr;
     ptr = malloc(size);
- -    if (!ptr)
+    if (!ptr && size)
         error("tcc malloc: memory full");
 #ifdef MEM_DEBUG
     mem_cur_size += malloc_usable_size(ptr);
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9jWWLytnOHirK9T8RAiAlAKCd9ym9oaqWXfsqOWKwGtDYWlKFMgCfV8zI
545YROLF+0cJIQL+ARCGJdU=
=sQTX
-----END PGP SIGNATURE-----

Attachment: tcc_malloc_uclibc_patch.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]