This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: valgrind -vs- jcf-dump


I'm checking this in.

Colin Walters noticed that 'valgrind jcf-dump some.jar' shows that
jcf-dump is free()ing something that was not allocated.  This patch
fixes the problem.

Tom

Index: ChangeLog
from  Colin Walters  <walters@redhat.com>

	https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=161701
	* jcf-io.c (open_class): Copy 'filename'.

Index: jcf-io.c
===================================================================
--- jcf-io.c	(revision 123217)
+++ jcf-io.c	(working copy)
@@ -259,7 +259,7 @@
       jcf->read_ptr = jcf->buffer;
       jcf->read_end = jcf->buffer_end;
       jcf->read_state = NULL;
-      jcf->filename = filename;
+      jcf->filename = xstrdup (filename);
       if (read (fd, jcf->buffer, stat_buf.st_size) != stat_buf.st_size)
 	{
 	  perror ("Failed to read .class file");


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