This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: libc/stdlib/mallocr.c (unlink)
- From: "J. Johnston" <jjohnstn at redhat dot com>
- To: newlib <newlib at sources dot redhat dot com>
- Date: Tue, 18 Feb 2003 17:35:14 -0500
- Subject: Re: libc/stdlib/mallocr.c (unlink)
- Organization: Red Hat Inc.
- References: <3E52AD3A.9000808@yahoo.com>
Patch checked in, thanks.
-- Jeff J.
Earnie Boyd wrote:
I've traced a SIGSEGV to this method. The attached patch has resolved
this issue.
Earnie.
------------------------------------------------------------------------
2003.02.18 Earnie Boyd <earnie@users.sf.net>
* libc/stdlib/mallocr.c (unlink): Don't assign a value to a pointer
with a NULL value.
Index: mallocr.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdlib/mallocr.c,v
retrieving revision 1.9
diff -u -3 -p -r1.9 mallocr.c
--- mallocr.c 11 Oct 2002 10:28:30 -0000 1.9
+++ mallocr.c 18 Feb 2003 21:40:05 -0000
@@ -1936,8 +1936,8 @@ static void do_check_malloced_chunk(p, 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 */