[1/3] pe_bfd_read_buildid memory leak

Message ID 20191224122452.1668-1-ssbssa@yahoo.de
State New, archived
Headers

Commit Message

Terekhov, Mikhail via Gdb-patches Dec. 24, 2019, 12:24 p.m. UTC
  bfd/ChangeLog:

2019-12-24  Hannes Domani  <ssbssa@yahoo.de>

	* peicode.h (pe_bfd_read_buildid): Free data.
---
 bfd/peicode.h | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Andrew Burgess Dec. 25, 2019, 1:47 p.m. UTC | #1
* Hannes Domani via gdb-patches <gdb-patches@sourceware.org> [2019-12-24 13:24:50 +0100]:

> bfd/ChangeLog:
> 
> 2019-12-24  Hannes Domani  <ssbssa@yahoo.de>
> 
> 	* peicode.h (pe_bfd_read_buildid): Free data.
> ---
>  bfd/peicode.h | 2 ++
>  1 file changed, 2 insertions(+)

Patches for binutils-gdb/bfd/* should be posted to the binutils list
(binutils@sourceware.org) for review.

Thanks,
Andrew


> 
> diff --git a/bfd/peicode.h b/bfd/peicode.h
> index e9d205a01a..00ccfa0a44 100644
> --- a/bfd/peicode.h
> +++ b/bfd/peicode.h
> @@ -1396,6 +1396,8 @@ pe_bfd_read_buildid (bfd *abfd)
>  	  break;
>  	}
>      }
> +
> +  free (data);
>  }
>  
>  static const bfd_target *
> -- 
> 2.24.1
>
  
Terekhov, Mikhail via Gdb-patches Dec. 25, 2019, 2:13 p.m. UTC | #2
Am Mittwoch, 25. Dezember 2019, 14:47:11 MEZ hat Andrew Burgess <andrew.burgess@embecosm.com> Folgendes geschrieben:

> * Hannes Domani via gdb-patches <gdb-patches@sourceware.org> [2019-12-24 13:24:50 +0100]:
>
> > bfd/ChangeLog:
> >
> > 2019-12-24  Hannes Domani  <ssbssa@yahoo.de>
> >
> >     * peicode.h (pe_bfd_read_buildid): Free data.
> > ---
> >  bfd/peicode.h | 2 ++
> >  1 file changed, 2 insertions(+)
>
> Patches for binutils-gdb/bfd/* should be posted to the binutils list
> (binutils@sourceware.org) for review.

Done.
But what about patches that change both bfd/* and gdb/*?
Send to both mailing lists?

> Thanks,
> Andrew
>
>
>
> >
> > diff --git a/bfd/peicode.h b/bfd/peicode.h
> > index e9d205a01a..00ccfa0a44 100644
> > --- a/bfd/peicode.h
> > +++ b/bfd/peicode.h
> > @@ -1396,6 +1396,8 @@ pe_bfd_read_buildid (bfd *abfd)
> >        break;
> >      }
> >      }
> > +
> > +  free (data);
> >  }
> >
> >  static const bfd_target *
> > --
> > 2.24.1
> >
  
Andrew Burgess Dec. 27, 2019, 4:46 p.m. UTC | #3
* Hannes Domani via gdb-patches <gdb-patches@sourceware.org> [2019-12-25 14:13:59 +0000]:

>  Am Mittwoch, 25. Dezember 2019, 14:47:11 MEZ hat Andrew Burgess <andrew.burgess@embecosm.com> Folgendes geschrieben:
> 
> > * Hannes Domani via gdb-patches <gdb-patches@sourceware.org> [2019-12-24 13:24:50 +0100]:
> >
> > > bfd/ChangeLog:
> > >
> > > 2019-12-24  Hannes Domani  <ssbssa@yahoo.de>
> > >
> > >     * peicode.h (pe_bfd_read_buildid): Free data.
> > > ---
> > >  bfd/peicode.h | 2 ++
> > >  1 file changed, 2 insertions(+)
> >
> > Patches for binutils-gdb/bfd/* should be posted to the binutils list
> > (binutils@sourceware.org) for review.
> 
> Done.
> But what about patches that change both bfd/* and gdb/*?
> Send to both mailing lists?

Absolutely, if they really can't be split into two parts then just
post to both lists.

Thanks,
Andrew


> 
> > Thanks,
> > Andrew
> >
> >
> >
> > >
> > > diff --git a/bfd/peicode.h b/bfd/peicode.h
> > > index e9d205a01a..00ccfa0a44 100644
> > > --- a/bfd/peicode.h
> > > +++ b/bfd/peicode.h
> > > @@ -1396,6 +1396,8 @@ pe_bfd_read_buildid (bfd *abfd)
> > >        break;
> > >      }
> > >      }
> > > +
> > > +  free (data);
> > >  }
> > >
> > >  static const bfd_target *
> > > --
> > > 2.24.1
> > >
>
  

Patch

diff --git a/bfd/peicode.h b/bfd/peicode.h
index e9d205a01a..00ccfa0a44 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -1396,6 +1396,8 @@  pe_bfd_read_buildid (bfd *abfd)
 	  break;
 	}
     }
+
+  free (data);
 }
 
 static const bfd_target *