public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* readelf.c (process_version_sections): Free memory returned by get_data.
@ 2011-03-08  1:02 Michael Snyder
  2011-03-14 12:14 ` Richard Sandiford
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Snyder @ 2011-03-08  1:02 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 5 bytes --]

OK?


[-- Attachment #2: readelf2.txt --]
[-- Type: text/plain, Size: 1517 bytes --]

2011-03-07  Michael Snyder  <msnyder@vmware.com>

	* readelf.c (process_version_sections): Free memory returned by 
	get_data.

Index: readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.534
diff -u -p -r1.534 readelf.c
--- readelf.c	1 Mar 2011 00:02:32 -0000	1.534
+++ readelf.c	8 Mar 2011 00:59:06 -0000
@@ -8194,6 +8198,7 @@ process_version_sections (FILE * file)
 			  Elf_Internal_Verdef ivd;
 			  Elf_External_Verdef evd;
 			  unsigned long offset;
+			  void *tmp;
 
 			  offset = offset_from_vma
 			    (file, version_info[DT_VERSIONTAGIDX (DT_VERDEF)],
@@ -8201,8 +8206,10 @@ process_version_sections (FILE * file)
 
 			  do
 			    {
-			      get_data (&evd, file, offset, sizeof (evd), 1,
-					_("version def"));
+			      tmp = get_data (&evd, file, offset,
+					      sizeof (evd), 1,
+					      _("version def"));
+			      free (tmp);
 
 			      ivd.vd_next = BYTE_GET (evd.vd_next);
 			      ivd.vd_ndx  = BYTE_GET (evd.vd_ndx);
@@ -8219,10 +8226,11 @@ process_version_sections (FILE * file)
 
 			      ivd.vd_aux = BYTE_GET (evd.vd_aux);
 
-			      get_data (&evda, file,
-					offset - ivd.vd_next + ivd.vd_aux,
-					sizeof (evda), 1,
-					_("version def aux"));
+			      tmp = get_data (&evda, file,
+					      offset - ivd.vd_next + ivd.vd_aux,
+					      sizeof (evda), 1,
+					      _("version def aux"));
+			      free (tmp);
 
 			      ivda.vda_name = BYTE_GET (evda.vda_name);
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: readelf.c (process_version_sections): Free memory returned by get_data.
  2011-03-08  1:02 readelf.c (process_version_sections): Free memory returned by get_data Michael Snyder
@ 2011-03-14 12:14 ` Richard Sandiford
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2011-03-14 12:14 UTC (permalink / raw)
  To: Michael Snyder; +Cc: binutils

Michael Snyder <msnyder@vmware.com> writes:
> @@ -8201,8 +8206,10 @@ process_version_sections (FILE * file)
>  
>  			  do
>  			    {
> -			      get_data (&evd, file, offset, sizeof (evd), 1,
> -					_("version def"));
> +			      tmp = get_data (&evd, file, offset,
> +					      sizeof (evd), 1,
> +					      _("version def"));
> +			      free (tmp);
>  
>  			      ivd.vd_next = BYTE_GET (evd.vd_next);
>  			      ivd.vd_ndx  = BYTE_GET (evd.vd_ndx);

This doesn't look right.  get_data returns &evd in this case,
doesn't it?

Richard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-14 12:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-08  1:02 readelf.c (process_version_sections): Free memory returned by get_data Michael Snyder
2011-03-14 12:14 ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).