Skip to content

Commit

Permalink
Merge pull request #1 from vapor/leak-fix
Browse files Browse the repository at this point in the history
fix cycle leak
  • Loading branch information
tanner0101 authored Feb 3, 2017
2 parents 82faa1f + 3d0d7da commit 2ea24e5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Sources/FormData/Parser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ public final class Parser {
public init(multipart: Multipart.Parser) {
self.multipart = multipart

self.multipart.onPart = { part in
if let contentDisposition = part.headers[.contentDisposition] {
self.multipart.onPart = { [weak self] part in
if
let contentDisposition = part.headers[.contentDisposition],
let welf = self
{
let parser = ContentDispositionParser()

var name: String?
Expand All @@ -50,7 +53,7 @@ public final class Parser {

if let name = name {
let field = Field(name: name, filename: filename, part: part)
self.onField?(field)
welf.onField?(field)
}

}
Expand Down

0 comments on commit 2ea24e5

Please sign in to comment.