diff options
author | Dylan Hardison <dylan@mozilla.com> | 2016-07-04 23:36:58 +0200 |
---|---|---|
committer | Dylan Hardison <dylan@mozilla.com> | 2016-07-04 23:36:58 +0200 |
commit | 9a15297a823443b19661211293bb79e7f42a44e3 (patch) | |
tree | 6201a329e16964b86f74a8c152e3b63d66c7339f /Bugzilla/Attachment.pm | |
parent | 3bf65ba172080fbed1e7d4e285075fa67de73fed (diff) | |
download | bugzilla-9a15297a823443b19661211293bb79e7f42a44e3.tar.gz bugzilla-9a15297a823443b19661211293bb79e7f42a44e3.tar.xz |
Bug 1282606 - Fix TrackingFlags memory leak
Diffstat (limited to 'Bugzilla/Attachment.pm')
-rw-r--r-- | Bugzilla/Attachment.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm index 0cdec6bf0..3b4953f64 100644 --- a/Bugzilla/Attachment.pm +++ b/Bugzilla/Attachment.pm @@ -62,6 +62,7 @@ use Bugzilla::Hook; use File::Copy; use List::Util qw(max); +use Scalar::Util qw(weaken); use Storable qw(dclone); use base qw(Bugzilla::Object); @@ -157,8 +158,12 @@ the bug object to which the attachment is attached =cut sub bug { + my ($self) = @_; require Bugzilla::Bug; - return $_[0]->{bug} //= Bugzilla::Bug->new({ id => $_[0]->bug_id, cache => 1 }); + return $self->{bug} if defined $self->{bug}; + my $bug = $self->{bug} = Bugzilla::Bug->new({ id => $_[0]->bug_id, cache => 1 }); + weaken($self->{bug}); + return $bug; } =over |