This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Fix crash on demangle style completion


This is an obvious fix (Just try completing on the demangle style, and
look what happens), so i'm checking it in.

2001-04-16  Daniel Berlin  <dan@cgsoftware.com>
 
 	* demangle.c (_initialize_demangler): Use xcalloc on the
 	demangling_style_names, and make it a null terminated array of
 	names, to avoid a crash.
 


Index: demangle.c
===================================================================
RCS file: /cvs/src/src/gdb/demangle.c,v
retrieving revision 1.7
diff -c -3 -p -w -B -b -r1.7 demangle.c
*** demangle.c	2001/03/06 08:21:06	1.7
--- demangle.c	2001/04/16 14:34:53
*************** _initialize_demangler (void)
*** 186,192 ****
         libiberty_demanglers[ndems].demangling_style != unknown_demangling; 
         ndems++)
      ;
!   demangling_style_names = xmalloc (ndems * sizeof (char *));
    for (i = 0;
         libiberty_demanglers[i].demangling_style != unknown_demangling; 
         i++)
--- 186,192 ----
         libiberty_demanglers[ndems].demangling_style != unknown_demangling; 
         ndems++)
      ;
!   demangling_style_names = xcalloc (ndems + 1, sizeof (char *));
    for (i = 0;
         libiberty_demanglers[i].demangling_style != unknown_demangling; 
         i++)

-- 
I have two very rare photographs.  One is a picture of Houdini
locking his keys in his car.  The other is a rare photograph of
Norman Rockwell beating up a child.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]