Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed small memory leak in Mojo::DOM
  • Loading branch information
kraih committed Oct 6, 2011
1 parent 387f3f4 commit 46500af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions Changes
Expand Up @@ -11,6 +11,7 @@ This file documents the revision history for Perl extension Mojolicious.
- Improved tests.
- Fixed many portability issues.
- Fixed on_finish callback to work consistently with all servers.
- Fixed small memory leak in Mojo::DOM.
- Fixed small formatting bug in Mojo::Headers.
- Fixed small proxy message generation bug.
- Fixed small detection bug in Mojolicious::Types.
Expand Down
7 changes: 5 additions & 2 deletions lib/Mojo/DOM.pm
Expand Up @@ -10,7 +10,7 @@ use Carp 'croak';
use Mojo::Collection;
use Mojo::DOM::CSS;
use Mojo::DOM::HTML;
use Scalar::Util 'blessed';
use Scalar::Util qw/blessed weaken/;

sub AUTOLOAD {
my $self = shift;
Expand Down Expand Up @@ -372,7 +372,10 @@ sub _parent {
my ($children, $parent) = @_;
my @new;
for my $e (@$children[1 .. $#$children]) {
$e->[3] = $parent if $e->[0] eq 'tag';
if ($e->[0] eq 'tag') {
$e->[3] = $parent;
weaken $e->[3];
}
push @new, $e;
}
return \@new;
Expand Down

0 comments on commit 46500af

Please sign in to comment.