From b1ca765e841a6347450cea6738e5b40a692a2aba Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 18 Feb 2003 22:34:02 +0000 Subject: [PATCH] 2003-02-18 Earnie Boyd * libc/stdlib/mallocr.c (unlink): Don't assign a value to a pointer with a NULL value. --- newlib/ChangeLog | 5 +++++ newlib/libc/stdlib/mallocr.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 0a6191f2a..0d2a38c1c 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2003-02-18 Earnie Boyd + + * libc/stdlib/mallocr.c (unlink): Don't assign a value to a pointer + with a NULL value. + 2003-02-10 Christopher Faylor * libc/include/sys/types.h: Don't define __MS_types__ for Cygwin. diff --git a/newlib/libc/stdlib/mallocr.c b/newlib/libc/stdlib/mallocr.c index 3da707e3d..fa2278224 100644 --- a/newlib/libc/stdlib/mallocr.c +++ b/newlib/libc/stdlib/mallocr.c @@ -1936,8 +1936,8 @@ static void do_check_malloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s; { \ BK = P->bk; \ FD = P->fd; \ - FD->bk = BK; \ - BK->fd = FD; \ + if (FD) FD->bk = BK; \ + if (BK) BK->fd = FD; \ } \ /* Place p as the last remainder */