Patch: FYI: valgrind -vs- jcf-dump

Tom Tromey tromey@redhat.com
Fri Apr 6 14:27:00 GMT 2007


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");



More information about the Java-patches mailing list