This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH]: malloc (0) during throw etc
- To: gcc-patches at gcc dot gnu dot org
- Subject: [PATCH]: malloc (0) during throw etc
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Thu, 08 Jun 2000 09:32:09 +0100
- CC: mark at codesourcery dot com, dyp at perchine dot com
- Organization: CodeSourcery, LLC
Hi,
Under the obvious rule I've installed the attached, which is
Denis Perchine's patch to avoid malloc (0), and a tweak of mine
to avoid
if (ptr) { .... if (ptr) free (ptr);}
booted & tested on i686-pc-linux-gnu
Denis, next time could you provide you patches with a ChangeLog
entry (even such one-liners), and provide -c3p diff's. See
http://gcc.gnu.org/contribute.html for details. This one's
small enough to not need an assignment.
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-06-08 Nathan Sidwell <nathan@codesourcery.com>
* frame.c (end_fde_sort): Remove extraneous erratic array test.
2000-06-08 Denis Perchine <dyp@perchine.com>
* frame.c (start_fde_sort): Don't malloc (0).
Index: frame.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/frame.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 frame.c
*** frame.c 2000/05/25 15:21:50 1.36
--- frame.c 2000/06/08 08:21:25
*************** typedef struct fde_accumulator
*** 59,65 ****
static inline int
start_fde_sort (fde_accumulator *accu, size_t count)
{
! accu->linear.array = (fde **) malloc (sizeof (fde *) * count);
accu->erratic.array = accu->linear.array ?
(fde **) malloc (sizeof (fde *) * count) : NULL;
accu->linear.count = 0;
--- 59,65 ----
static inline int
start_fde_sort (fde_accumulator *accu, size_t count)
{
! accu->linear.array = count ? (fde **) malloc (sizeof (fde *) * count) : NULL;
accu->erratic.array = accu->linear.array ?
(fde **) malloc (sizeof (fde *) * count) : NULL;
accu->linear.count = 0;
*************** end_fde_sort (fde_accumulator *accu, siz
*** 230,237 ****
abort ();
frame_heapsort (&accu->erratic);
fde_merge (&accu->linear, &accu->erratic);
! if (accu->erratic.array)
! free (accu->erratic.array);
}
else
{
--- 230,236 ----
abort ();
frame_heapsort (&accu->erratic);
fde_merge (&accu->linear, &accu->erratic);
! free (accu->erratic.array);
}
else
{