summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Attachment.pm
diff options
context:
space:
mode:
authorDylan Hardison <dylan@mozilla.com>2016-07-04 23:36:58 +0200
committerDylan Hardison <dylan@mozilla.com>2016-07-04 23:36:58 +0200
commit9a15297a823443b19661211293bb79e7f42a44e3 (patch)
tree6201a329e16964b86f74a8c152e3b63d66c7339f /Bugzilla/Attachment.pm
parent3bf65ba172080fbed1e7d4e285075fa67de73fed (diff)
downloadbugzilla-9a15297a823443b19661211293bb79e7f42a44e3.tar.gz
bugzilla-9a15297a823443b19661211293bb79e7f42a44e3.tar.xz
Bug 1282606 - Fix TrackingFlags memory leak
Diffstat (limited to 'Bugzilla/Attachment.pm')
-rw-r--r--Bugzilla/Attachment.pm7
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