Subject: | [PATCH] fix output of filenames in leak trace |
Date: | Mon, 8 Oct 2007 02:10:26 -0600 |
To: | bug-Devel-LeakTrace-Fast [...] rt.cpan.org |
From: | "Alex Hunsaker" <badalex [...] gmail.com> |
Fix a use after free bug... pretty self explanatory I think...
(patch attached as well for gmail breakage)
diff -ruN Devel-LeakTrace-Fast-0.0.3.orig/tools.c
Devel-LeakTrace-Fast-0.0.3/tools.c
--- Devel-LeakTrace-Fast-0.0.3.orig/tools.c 2007-02-07
14:16:05.000000000 -0700
+++ Devel-LeakTrace-Fast-0.0.3/tools.c 2007-10-08 02:04:21.512107980 -0600
@@ -324,7 +324,11 @@
if (interesting_op(PL_op->op_type)) {
/*fprintf(stderr, "%s, line %d\n", lastfile, lastline); */
NOTE_NEW_VARS(lastline, lastfile);
- lastfile = CopFILE(cCOP);
+ if (lastfile) {
+ free(lastfile);
+ }
+ if (!(lastfile = strdup(CopFILE(cCOP)))) {
+ nomem();
lastline = CopLINE(cCOP);
}
}
@@ -332,6 +336,10 @@
/*fprintf(stderr, "%s, line %d\n", lastfile, lastline); */
NOTE_NEW_VARS(lastline, lastfile);
+ if (lastfile) {
+ free(lastfile);
+ }
+
TAINT_NOT;
return 0;
}
Message body is not shown because sender requested not to inline it.