{"action":"created","comment":{"url":"https://api.github.com/repos/apple/swift/pulls/comments/142310375","pull_request_review_id":66651905,"id":142310375,"diff_hunk":"@@ -73,13 +73,15 @@ public func _stdlib_pthread_barrier_init(\n     return -1\n   }\n   barrier.pointee.mutex = UnsafeMutablePointer.allocate(capacity: 1)\n-  if pthread_mutex_init(barrier.pointee.mutex!, nil) != 0 {\n-    // FIXME: leaking memory.\n+  guard pthread_mutex_init(barrier.pointee.mutex!, nil) == 0 else {\n+    barrier.pointee.mutex!.deinitialize()\n+    barrier.pointee.mutex!.deallocate(capacity: 1)\n     return -1\n   }\n   barrier.pointee.cond = UnsafeMutablePointer.allocate(capacity: 1)\n-  if pthread_cond_init(barrier.pointee.cond!, nil) != 0 {\n-    // FIXME: leaking memory, leaking a mutex.\n+  guard pthread_cond_init(barrier.pointee.cond!, nil) == 0 else {\n+    barrier.pointee.cond!.deinitialize()\n+    barrier.pointee.cond!.deallocate(capacity: 1)","path":"stdlib/private/SwiftPrivatePthreadExtras/PthreadBarriers.swift","position":16,"original_position":16,"commit_id":"6ccd93409d38e4fb7e61e6a4986a0e0878e581e3","original_commit_id":"6ccd93409d38e4fb7e61e6a4986a0e0878e581e3","user":{"login":"chrisamanse","id":12277586,"avatar_url":"https://avatars1.githubusercontent.com/u/12277586?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisamanse","html_url":"https://github.com/chrisamanse","followers_url":"https://api.github.com/users/chrisamanse/followers","following_url":"https://api.github.com/users/chrisamanse/following{/other_user}","gists_url":"https://api.github.com/users/chrisamanse/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisamanse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisamanse/subscriptions","organizations_url":"https://api.github.com/users/chrisamanse/orgs","repos_url":"https://api.github.com/users/chrisamanse/repos","events_url":"https://api.github.com/users/chrisamanse/events{/privacy}","received_events_url":"https://api.github.com/users/chrisamanse/received_events","type":"User","site_admin":false},"body":"Understood. Updating code to destroy mutex when `pthread_cond_init` fails.","created_at":"2017-10-03T04:37:05Z","updated_at":"2017-10-03T04:37:06Z","html_url":"https://github.com/apple/swift/pull/12212#discussion_r142310375","pull_request_url":"https://api.github.com/repos/apple/swift/pulls/12212","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apple/swift/pulls/comments/142310375"},"html":{"href":"https://github.com/apple/swift/pull/12212#discussion_r142310375"},"pull_request":{"href":"https://api.github.com/repos/apple/swift/pulls/12212"}},"in_reply_to_id":142246724},"pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/12212","id":144115547,"html_url":"https://github.com/apple/swift/pull/12212","diff_url":"https://github.com/apple/swift/pull/12212.diff","patch_url":"https://github.com/apple/swift/pull/12212.patch","issue_url":"https://api.github.com/repos/apple/swift/issues/12212","number":12212,"state":"open","locked":false,"title":"Fix memory leaks in PthreadBarriers.swift","user":{"login":"chrisamanse","id":12277586,"avatar_url":"https://avatars1.githubusercontent.com/u/12277586?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisamanse","html_url":"https://github.com/chrisamanse","followers_url":"https://api.github.com/users/chrisamanse/followers","following_url":"https://api.github.com/users/chrisamanse/following{/other_user}","gists_url":"https://api.github.com/users/chrisamanse/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisamanse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisamanse/subscriptions","organizations_url":"https://api.github.com/users/chrisamanse/orgs","repos_url":"https://api.github.com/users/chrisamanse/repos","events_url":"https://api.github.com/users/chrisamanse/events{/privacy}","received_events_url":"https://api.github.com/users/chrisamanse/received_events","type":"User","site_admin":false},"body":"<!-- What's in this pull request? -->\r\nFix memory leaks in PthreadBarriers.swift as indicated by `FIXME`s.\r\n\r\n<!-- If this pull request resolves any bugs in the Swift bug tracker, provide a link: -->\r\n\r\n<!--\r\nBefore merging this pull request, you must run the Swift continuous integration tests.\r\nFor information about triggering CI builds via @swift-ci, see:\r\nhttps://github.com/apple/swift/blob/master/docs/ContinuousIntegration.md#swift-ci\r\n\r\nThank you for your contribution to Swift!\r\n-->\r\n","created_at":"2017-10-02T06:05:22Z","updated_at":"2017-10-03T04:37:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"27d20833076d4587ffb306b583993959d357202c","assignee":null,"assignees":[],"requested_reviewers":[{"login":"airspeedswift","id":8058277,"avatar_url":"https://avatars1.githubusercontent.com/u/8058277?v=4","gravatar_id":"","url":"https://api.github.com/users/airspeedswift","html_url":"https://github.com/airspeedswift","followers_url":"https://api.github.com/users/airspeedswift/followers","following_url":"https://api.github.com/users/airspeedswift/following{/other_user}","gists_url":"https://api.github.com/users/airspeedswift/gists{/gist_id}","starred_url":"https://api.github.com/users/airspeedswift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airspeedswift/subscriptions","organizations_url":"https://api.github.com/users/airspeedswift/orgs","repos_url":"https://api.github.com/users/airspeedswift/repos","events_url":"https://api.github.com/users/airspeedswift/events{/privacy}","received_events_url":"https://api.github.com/users/airspeedswift/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/apple/swift/pulls/12212/commits","review_comments_url":"https://api.github.com/repos/apple/swift/pulls/12212/comments","review_comment_url":"https://api.github.com/repos/apple/swift/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apple/swift/issues/12212/comments","statuses_url":"https://api.github.com/repos/apple/swift/statuses/6ccd93409d38e4fb7e61e6a4986a0e0878e581e3","head":{"label":"chrisamanse:fix-pthread-leaks","ref":"fix-pthread-leaks","sha":"6ccd93409d38e4fb7e61e6a4986a0e0878e581e3","user":{"login":"chrisamanse","id":12277586,"avatar_url":"https://avatars1.githubusercontent.com/u/12277586?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisamanse","html_url":"https://github.com/chrisamanse","followers_url":"https://api.github.com/users/chrisamanse/followers","following_url":"https://api.github.com/users/chrisamanse/following{/other_user}","gists_url":"https://api.github.com/users/chrisamanse/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisamanse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisamanse/subscriptions","organizations_url":"https://api.github.com/users/chrisamanse/orgs","repos_url":"https://api.github.com/users/chrisamanse/repos","events_url":"https://api.github.com/users/chrisamanse/events{/privacy}","received_events_url":"https://api.github.com/users/chrisamanse/received_events","type":"User","site_admin":false},"repo":{"id":88440141,"name":"swift","full_name":"chrisamanse/swift","owner":{"login":"chrisamanse","id":12277586,"avatar_url":"https://avatars1.githubusercontent.com/u/12277586?v=4","gravatar_id":"","url":"https://api.github.com/users/chrisamanse","html_url":"https://github.com/chrisamanse","followers_url":"https://api.github.com/users/chrisamanse/followers","following_url":"https://api.github.com/users/chrisamanse/following{/other_user}","gists_url":"https://api.github.com/users/chrisamanse/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisamanse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisamanse/subscriptions","organizations_url":"https://api.github.com/users/chrisamanse/orgs","repos_url":"https://api.github.com/users/chrisamanse/repos","events_url":"https://api.github.com/users/chrisamanse/events{/privacy}","received_events_url":"https://api.github.com/users/chrisamanse/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chrisamanse/swift","description":"The Swift Programming Language","fork":true,"url":"https://api.github.com/repos/chrisamanse/swift","forks_url":"https://api.github.com/repos/chrisamanse/swift/forks","keys_url":"https://api.github.com/repos/chrisamanse/swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chrisamanse/swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chrisamanse/swift/teams","hooks_url":"https://api.github.com/repos/chrisamanse/swift/hooks","issue_events_url":"https://api.github.com/repos/chrisamanse/swift/issues/events{/number}","events_url":"https://api.github.com/repos/chrisamanse/swift/events","assignees_url":"https://api.github.com/repos/chrisamanse/swift/assignees{/user}","branches_url":"https://api.github.com/repos/chrisamanse/swift/branches{/branch}","tags_url":"https://api.github.com/repos/chrisamanse/swift/tags","blobs_url":"https://api.github.com/repos/chrisamanse/swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chrisamanse/swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chrisamanse/swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/chrisamanse/swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chrisamanse/swift/statuses/{sha}","languages_url":"https://api.github.com/repos/chrisamanse/swift/languages","stargazers_url":"https://api.github.com/repos/chrisamanse/swift/stargazers","contributors_url":"https://api.github.com/repos/chrisamanse/swift/contributors","subscribers_url":"https://api.github.com/repos/chrisamanse/swift/subscribers","subscription_url":"https://api.github.com/repos/chrisamanse/swift/subscription","commits_url":"https://api.github.com/repos/chrisamanse/swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/chrisamanse/swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/chrisamanse/swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/chrisamanse/swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/chrisamanse/swift/contents/{+path}","compare_url":"https://api.github.com/repos/chrisamanse/swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chrisamanse/swift/merges","archive_url":"https://api.github.com/repos/chrisamanse/swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chrisamanse/swift/downloads","issues_url":"https://api.github.com/repos/chrisamanse/swift/issues{/number}","pulls_url":"https://api.github.com/repos/chrisamanse/swift/pulls{/number}","milestones_url":"https://api.github.com/repos/chrisamanse/swift/milestones{/number}","notifications_url":"https://api.github.com/repos/chrisamanse/swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chrisamanse/swift/labels{/name}","releases_url":"https://api.github.com/repos/chrisamanse/swift/releases{/id}","deployments_url":"https://api.github.com/repos/chrisamanse/swift/deployments","created_at":"2017-04-16T20:15:25Z","updated_at":"2017-04-16T20:15:50Z","pushed_at":"2017-10-02T06:09:30Z","git_url":"git://github.com/chrisamanse/swift.git","ssh_url":"git@github.com:chrisamanse/swift.git","clone_url":"https://github.com/chrisamanse/swift.git","svn_url":"https://github.com/chrisamanse/swift","homepage":"https://swift.org/","size":222344,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apple:master","ref":"master","sha":"13cff4986c203649337a96957fbca18423814fc0","user":{"login":"apple","id":10639145,"avatar_url":"https://avatars0.githubusercontent.com/u/10639145?v=4","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"repo":{"id":44838949,"name":"swift","full_name":"apple/swift","owner":{"login":"apple","id":10639145,"avatar_url":"https://avatars0.githubusercontent.com/u/10639145?v=4","gravatar_id":"","url":"https://api.github.com/users/apple","html_url":"https://github.com/apple","followers_url":"https://api.github.com/users/apple/followers","following_url":"https://api.github.com/users/apple/following{/other_user}","gists_url":"https://api.github.com/users/apple/gists{/gist_id}","starred_url":"https://api.github.com/users/apple/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apple/subscriptions","organizations_url":"https://api.github.com/users/apple/orgs","repos_url":"https://api.github.com/users/apple/repos","events_url":"https://api.github.com/users/apple/events{/privacy}","received_events_url":"https://api.github.com/users/apple/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apple/swift","description":"The Swift Programming Language","fork":false,"url":"https://api.github.com/repos/apple/swift","forks_url":"https://api.github.com/repos/apple/swift/forks","keys_url":"https://api.github.com/repos/apple/swift/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apple/swift/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apple/swift/teams","hooks_url":"https://api.github.com/repos/apple/swift/hooks","issue_events_url":"https://api.github.com/repos/apple/swift/issues/events{/number}","events_url":"https://api.github.com/repos/apple/swift/events","assignees_url":"https://api.github.com/repos/apple/swift/assignees{/user}","branches_url":"https://api.github.com/repos/apple/swift/branches{/branch}","tags_url":"https://api.github.com/repos/apple/swift/tags","blobs_url":"https://api.github.com/repos/apple/swift/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apple/swift/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apple/swift/git/refs{/sha}","trees_url":"https://api.github.com/repos/apple/swift/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apple/swift/statuses/{sha}","languages_url":"https://api.github.com/repos/apple/swift/languages","stargazers_url":"https://api.github.com/repos/apple/swift/stargazers","contributors_url":"https://api.github.com/repos/apple/swift/contributors","subscribers_url":"https://api.github.com/repos/apple/swift/subscribers","subscription_url":"https://api.github.com/repos/apple/swift/subscription","commits_url":"https://api.github.com/repos/apple/swift/commits{/sha}","git_commits_url":"https://api.github.com/repos/apple/swift/git/commits{/sha}","comments_url":"https://api.github.com/repos/apple/swift/comments{/number}","issue_comment_url":"https://api.github.com/repos/apple/swift/issues/comments{/number}","contents_url":"https://api.github.com/repos/apple/swift/contents/{+path}","compare_url":"https://api.github.com/repos/apple/swift/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apple/swift/merges","archive_url":"https://api.github.com/repos/apple/swift/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apple/swift/downloads","issues_url":"https://api.github.com/repos/apple/swift/issues{/number}","pulls_url":"https://api.github.com/repos/apple/swift/pulls{/number}","milestones_url":"https://api.github.com/repos/apple/swift/milestones{/number}","notifications_url":"https://api.github.com/repos/apple/swift/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apple/swift/labels{/name}","releases_url":"https://api.github.com/repos/apple/swift/releases{/id}","deployments_url":"https://api.github.com/repos/apple/swift/deployments","created_at":"2015-10-23T21:15:07Z","updated_at":"2017-10-03T04:30:02Z","pushed_at":"2017-10-03T04:23:35Z","git_url":"git://github.com/apple/swift.git","ssh_url":"git@github.com:apple/swift.git","clone_url":"https://github.com/apple/swift.git","svn_url":"https://github.com/apple/swift","homepage":"https://swift.org/","size":229386,"stargazers_count":40783,"watchers_count":40783,"language":"C++","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6297,"mirror_url":null,"open_issues_count":177,"forks":6297,"open_issues":177,"watchers":40783,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apple/swift/pulls/12212"},"html":{"href":"https://github.com/apple/swift/pull/12212"},"issue":{"href":"https://api.github.com/repos/apple/swift/issues/12212"},"comments":{"href":"https://api.github.com/repos/apple/swift/issues/12212/comments"},"review_comments":{"href":"https://api.github.com/repos/apple/swift/pulls/12212/comments"},"review_comment":{"href":"https://api.github.com/repos/apple/swift/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apple/swift/pulls/12212/commits"},"statuses":{"href":"https://api.github.com/repos/apple/swift/statuses/6ccd93409d38e4fb7e61e6a4986a0e0878e581e3"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"chrisamanse"}}