Fix a buglet in malloc/mtrace.pl

Message ID CALoOobNAMFKaXX6pemAeeAG97s6+M=dMuNiqmU6s+DJ-dpAZMQ@mail.gmail.com
State Committed
Headers

Commit Message

Paul Pluzhnikov Aug. 14, 2015, 3 p.m. UTC
  On Fri, Aug 14, 2015 at 12:31 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Paul Pluzhnikov <ppluzhnikov@gmail.com> writes:
>

>> -         } else {
>> +         } elsif ($allocaddr != "(nil}") {
>
> Can this ever be false?

Oops. You are almost right: the condition above is actually never
false (my Perl is getting rusty, one does not simply compare strings
with != in Perl!).
The end result is that all leak detection is suppressed :-(

Corrected patch attached.
  

Comments

Paul Pluzhnikov Aug. 19, 2015, 12:42 a.m. UTC | #1
On Fri, Aug 14, 2015 at 8:00 AM, Paul Pluzhnikov <ppluzhnikov@google.com> wrote:
> On Fri, Aug 14, 2015 at 12:31 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
>> Paul Pluzhnikov <ppluzhnikov@gmail.com> writes:
>>
>
>>> -         } else {
>>> +         } elsif ($allocaddr != "(nil}") {
>>
>> Can this ever be false?
>
> Oops. You are almost right: the condition above is actually never
> false (my Perl is getting rusty, one does not simply compare strings
> with != in Perl!).
> The end result is that all leak detection is suppressed :-(
>
> Corrected patch attached.

Ping?

This buglet prevents me from committing fix for BZ #18757.

Thanks,
  
Paul Pluzhnikov Aug. 25, 2015, 6:17 a.m. UTC | #2
On Tue, Aug 18, 2015 at 5:42 PM, Paul Pluzhnikov <ppluzhnikov@google.com> wrote:

> Ping?

Ping x2?

> This buglet prevents me from committing fix for BZ #18757.

Thanks,
  

Patch

diff --git a/malloc/mtrace.pl b/malloc/mtrace.pl
index 0737890..6227049 100644
--- a/malloc/mtrace.pl
+++ b/malloc/mtrace.pl
@@ -167,7 +167,7 @@  while (<DATA>) {
 		printf ("+ %#0@XXX@x Alloc %d duplicate: %s %s\n",
 			hex($allocaddr), $nr, &location($addrwas{$allocaddr}),
 			$where);
-	    } else {
+	    } elsif ($allocaddr =~ /^0x/) {
 		$allocated{$allocaddr}=$howmuch;
 		$addrwas{$allocaddr}=$where;
 	    }