Skip to content

Commit

Permalink
Merge pull request #6 from koeppe/master
Browse files Browse the repository at this point in the history
Memory leak in AnyEvent::CouchDB::Database::attach
  • Loading branch information
beppu committed Nov 1, 2011
2 parents 3b7bcd8 + 4ee1dc7 commit 0701a45
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/AnyEvent/CouchDB/Database.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ sub remove_doc {
sub attach { sub attach {
my ( $self, $doc, $attachment, $options ) = @_; my ( $self, $doc, $attachment, $options ) = @_;
my $body < io( $options->{src} ); my $body < io( $options->{src} );
my $length = length($body);
$options->{type} ||= 'text/plain'; $options->{type} ||= 'text/plain';
if ( $options->{success} ) { if ( $options->{success} ) {
my $orig = $options->{success}; my $orig = $options->{success};
Expand All @@ -275,7 +276,7 @@ sub attach {
$doc->{_attachments} ||= {}; $doc->{_attachments} ||= {};
$doc->{_attachments}->{$attachment} = { $doc->{_attachments}->{$attachment} = {
'content_type' => $options->{type}, 'content_type' => $options->{type},
'length' => length($body), 'length' => $length,
'stub' => JSON::true, 'stub' => JSON::true,
}; };
}; };
Expand All @@ -288,7 +289,7 @@ sub attach {
$doc->{_attachments} ||= {}; $doc->{_attachments} ||= {};
$doc->{_attachments}->{$attachment} = { $doc->{_attachments}->{$attachment} = {
'content_type' => $options->{type}, 'content_type' => $options->{type},
'length' => length($body), 'length' => $length,
'stub' => JSON::true, 'stub' => JSON::true,
}; };
}; };
Expand Down

0 comments on commit 0701a45

Please sign in to comment.