[RFA] win32-nat printf and sprintf removal

Pierre Muller muller@cerbere.u-strasbg.fr
Thu Feb 14 03:36:00 GMT 2002


> > >@@ -2009,7 +2009,7 @@ _initialize_check_for_gdb_ini (void)
> > >       {
> > >         int len = strlen (oldini);
> > >         char *newini = alloca (len + 1);
> > >-        sprintf (newini, "%.*s.gdbinit", 
> > >+        xasprintf (newini, "%.*s.gdbinit", 
> > >           (int) (len - (sizeof ("gdb.ini") - 1)), oldini);
> > >         warning ("obsolete '%s' found. Rename to '%s'.", oldini, newini);
> > >       }
>
>   I corrected this one to this patch,
>which doesn't give any warning.
>But the memory allocated for oldini is still lost....

Whoops, once again, I clearly show my lack of C knowledge....
oldini is set by using alloca, and I just discovered that alloca
function does automatic disposal of the memory allocated at function exit.
  
  



Pierre Muller
Institut Charles Sadron
6,rue Boussingault
F 67083 STRASBOURG CEDEX (France)
mailto:muller@ics.u-strasbg.fr
Phone : (33)-3-88-41-40-07  Fax : (33)-3-88-41-40-99



More information about the Gdb-patches mailing list