* malloc/malloc.c (_int_free): Remove test for NULL parameter.
	(_int_realloc): Call _int_free only if memory parameter is not NULL.
This commit is contained in:
Ulrich Drepper 2004-11-13 05:43:36 +00:00
parent a9055cab7a
commit 37fa1953d5
4 changed files with 175 additions and 170 deletions

View File

@ -1,5 +1,8 @@
2004-11-12 Ulrich Drepper <drepper@redhat.com> 2004-11-12 Ulrich Drepper <drepper@redhat.com>
* malloc/malloc.c (_int_free): Remove test for NULL parameter.
(_int_realloc): Call _int_free only if memory parameter is not NULL.
* sysdeps/unix/sysv/linux/libc_fatal.c: Add new function __libc_message * sysdeps/unix/sysv/linux/libc_fatal.c: Add new function __libc_message
which performs the printing and simple format string handling. The which performs the printing and simple format string handling. The
string is written to tty, stderr, syslog in this order, stopping after string is written to tty, stderr, syslog in this order, stopping after

View File

@ -4196,8 +4196,6 @@ _int_free(mstate av, Void_t* mem)
mchunkptr fwd; /* misc temp for linking */ mchunkptr fwd; /* misc temp for linking */
/* free(0) has no effect */
if (mem != 0) {
const char *errstr = NULL; const char *errstr = NULL;
p = mem2chunk(mem); p = mem2chunk(mem);
@ -4381,7 +4379,6 @@ _int_free(mstate av, Void_t* mem)
assert(ret == 0); assert(ret == 0);
#endif #endif
} }
}
} }
/* /*
@ -4528,6 +4525,7 @@ _int_realloc(mstate av, Void_t* oldmem, size_t bytes)
#if REALLOC_ZERO_BYTES_FREES #if REALLOC_ZERO_BYTES_FREES
if (bytes == 0) { if (bytes == 0) {
if (oldmem != 0)
_int_free(av, oldmem); _int_free(av, oldmem);
return 0; return 0;
} }

View File

@ -129,6 +129,8 @@ __libc_message (int do_abort, const char *fmt, ...)
if (! written) if (! written)
vsyslog (LOG_ERR, fmt, ap_copy); vsyslog (LOG_ERR, fmt, ap_copy);
va_end (ap_copy);
if (do_abort() if (do_abort()
/* Kill the application. */ /* Kill the application. */
abort (); abort ();

View File

@ -141,6 +141,8 @@ __libc_message (int do_abort, const char *fmt, ...)
if (! written) if (! written)
vsyslog (LOG_ERR, fmt, ap_copy); vsyslog (LOG_ERR, fmt, ap_copy);
va_end (ap_copy);
if (do_abort) if (do_abort)
/* Terminate the process. */ /* Terminate the process. */
abort (); abort ();