{"action":"created","comment":{"url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/pulls/comments/48675739","id":48675739,"diff_hunk":"@@ -205,10 +205,8 @@ static void stat_update_cb(EV_P_ ev_timer *watcher, int revents)\n \n static void free_connections(struct ev_loop *loop)\n {\n-    struct cork_dllist_item *curr;\n-    for (curr = cork_dllist_start(&connections);\n-         !cork_dllist_is_end(&connections, curr);\n-         curr = curr->next) {\n+    struct cork_dllist_item *curr, *next;\n+    cork_dllist_foreach_void (&connections, curr, next) {\n         server_t *server = cork_container_of(curr, server_t, entries);","path":"src/server.c","position":10,"original_position":10,"commit_id":"a0098cfdb9047a31dd1e5e73f34d429ac366c424","original_commit_id":"a0098cfdb9047a31dd1e5e73f34d429ac366c424","user":{"login":"kery","id":3469040,"avatar_url":"https://avatars.githubusercontent.com/u/3469040?v=3","gravatar_id":"","url":"https://api.github.com/users/kery","html_url":"https://github.com/kery","followers_url":"https://api.github.com/users/kery/followers","following_url":"https://api.github.com/users/kery/following{/other_user}","gists_url":"https://api.github.com/users/kery/gists{/gist_id}","starred_url":"https://api.github.com/users/kery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kery/subscriptions","organizations_url":"https://api.github.com/users/kery/orgs","repos_url":"https://api.github.com/users/kery/repos","events_url":"https://api.github.com/users/kery/events{/privacy}","received_events_url":"https://api.github.com/users/kery/received_events","type":"User","site_admin":false},"body":"Sorry? The indent is OK . Please double-check.","created_at":"2016-01-01T03:13:23Z","updated_at":"2016-01-01T03:13:23Z","html_url":"https://github.com/shadowsocks/shadowsocks-libev/pull/502#discussion_r48675739","pull_request_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/pulls/502","_links":{"self":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/pulls/comments/48675739"},"html":{"href":"https://github.com/shadowsocks/shadowsocks-libev/pull/502#discussion_r48675739"},"pull_request":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/pulls/502"}}},"pull_request":{"url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/pulls/502","id":54886601,"html_url":"https://github.com/shadowsocks/shadowsocks-libev/pull/502","diff_url":"https://github.com/shadowsocks/shadowsocks-libev/pull/502.diff","patch_url":"https://github.com/shadowsocks/shadowsocks-libev/pull/502.patch","issue_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/issues/502","number":502,"state":"open","locked":false,"title":"Fix the crash issue in free_connections","user":{"login":"kery","id":3469040,"avatar_url":"https://avatars.githubusercontent.com/u/3469040?v=3","gravatar_id":"","url":"https://api.github.com/users/kery","html_url":"https://github.com/kery","followers_url":"https://api.github.com/users/kery/followers","following_url":"https://api.github.com/users/kery/following{/other_user}","gists_url":"https://api.github.com/users/kery/gists{/gist_id}","starred_url":"https://api.github.com/users/kery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kery/subscriptions","organizations_url":"https://api.github.com/users/kery/orgs","repos_url":"https://api.github.com/users/kery/repos","events_url":"https://api.github.com/users/kery/events{/privacy}","received_events_url":"https://api.github.com/users/kery/received_events","type":"User","site_admin":false},"body":"Sometime, ss-local.exe will crash while exiting. Root cause is that close_and_free_server will free the memory of server_t which contains cork_dllist_item (referenced by pointer curr). After that, the next iteration will use the curr->next to get the next item, but at this point the memory pointed by curr has been freed.","created_at":"2016-01-01T02:41:41Z","updated_at":"2016-01-01T03:13:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"461916cd0727b1cc3527b486fdbd86d612a70da5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/pulls/502/commits","review_comments_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/pulls/502/comments","review_comment_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/pulls/comments{/number}","comments_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/issues/502/comments","statuses_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/statuses/a0098cfdb9047a31dd1e5e73f34d429ac366c424","head":{"label":"kery:free_connections","ref":"free_connections","sha":"a0098cfdb9047a31dd1e5e73f34d429ac366c424","user":{"login":"kery","id":3469040,"avatar_url":"https://avatars.githubusercontent.com/u/3469040?v=3","gravatar_id":"","url":"https://api.github.com/users/kery","html_url":"https://github.com/kery","followers_url":"https://api.github.com/users/kery/followers","following_url":"https://api.github.com/users/kery/following{/other_user}","gists_url":"https://api.github.com/users/kery/gists{/gist_id}","starred_url":"https://api.github.com/users/kery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kery/subscriptions","organizations_url":"https://api.github.com/users/kery/orgs","repos_url":"https://api.github.com/users/kery/repos","events_url":"https://api.github.com/users/kery/events{/privacy}","received_events_url":"https://api.github.com/users/kery/received_events","type":"User","site_admin":false},"repo":{"id":48832739,"name":"shadowsocks-libev","full_name":"kery/shadowsocks-libev","owner":{"login":"kery","id":3469040,"avatar_url":"https://avatars.githubusercontent.com/u/3469040?v=3","gravatar_id":"","url":"https://api.github.com/users/kery","html_url":"https://github.com/kery","followers_url":"https://api.github.com/users/kery/followers","following_url":"https://api.github.com/users/kery/following{/other_user}","gists_url":"https://api.github.com/users/kery/gists{/gist_id}","starred_url":"https://api.github.com/users/kery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kery/subscriptions","organizations_url":"https://api.github.com/users/kery/orgs","repos_url":"https://api.github.com/users/kery/repos","events_url":"https://api.github.com/users/kery/events{/privacy}","received_events_url":"https://api.github.com/users/kery/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kery/shadowsocks-libev","description":"libev port of shadowsocks","fork":true,"url":"https://api.github.com/repos/kery/shadowsocks-libev","forks_url":"https://api.github.com/repos/kery/shadowsocks-libev/forks","keys_url":"https://api.github.com/repos/kery/shadowsocks-libev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kery/shadowsocks-libev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kery/shadowsocks-libev/teams","hooks_url":"https://api.github.com/repos/kery/shadowsocks-libev/hooks","issue_events_url":"https://api.github.com/repos/kery/shadowsocks-libev/issues/events{/number}","events_url":"https://api.github.com/repos/kery/shadowsocks-libev/events","assignees_url":"https://api.github.com/repos/kery/shadowsocks-libev/assignees{/user}","branches_url":"https://api.github.com/repos/kery/shadowsocks-libev/branches{/branch}","tags_url":"https://api.github.com/repos/kery/shadowsocks-libev/tags","blobs_url":"https://api.github.com/repos/kery/shadowsocks-libev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kery/shadowsocks-libev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kery/shadowsocks-libev/git/refs{/sha}","trees_url":"https://api.github.com/repos/kery/shadowsocks-libev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kery/shadowsocks-libev/statuses/{sha}","languages_url":"https://api.github.com/repos/kery/shadowsocks-libev/languages","stargazers_url":"https://api.github.com/repos/kery/shadowsocks-libev/stargazers","contributors_url":"https://api.github.com/repos/kery/shadowsocks-libev/contributors","subscribers_url":"https://api.github.com/repos/kery/shadowsocks-libev/subscribers","subscription_url":"https://api.github.com/repos/kery/shadowsocks-libev/subscription","commits_url":"https://api.github.com/repos/kery/shadowsocks-libev/commits{/sha}","git_commits_url":"https://api.github.com/repos/kery/shadowsocks-libev/git/commits{/sha}","comments_url":"https://api.github.com/repos/kery/shadowsocks-libev/comments{/number}","issue_comment_url":"https://api.github.com/repos/kery/shadowsocks-libev/issues/comments{/number}","contents_url":"https://api.github.com/repos/kery/shadowsocks-libev/contents/{+path}","compare_url":"https://api.github.com/repos/kery/shadowsocks-libev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kery/shadowsocks-libev/merges","archive_url":"https://api.github.com/repos/kery/shadowsocks-libev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kery/shadowsocks-libev/downloads","issues_url":"https://api.github.com/repos/kery/shadowsocks-libev/issues{/number}","pulls_url":"https://api.github.com/repos/kery/shadowsocks-libev/pulls{/number}","milestones_url":"https://api.github.com/repos/kery/shadowsocks-libev/milestones{/number}","notifications_url":"https://api.github.com/repos/kery/shadowsocks-libev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kery/shadowsocks-libev/labels{/name}","releases_url":"https://api.github.com/repos/kery/shadowsocks-libev/releases{/id}","created_at":"2015-12-31T04:10:10Z","updated_at":"2015-12-31T04:10:13Z","pushed_at":"2016-01-01T02:33:24Z","git_url":"git://github.com/kery/shadowsocks-libev.git","ssh_url":"git@github.com:kery/shadowsocks-libev.git","clone_url":"https://github.com/kery/shadowsocks-libev.git","svn_url":"https://github.com/kery/shadowsocks-libev","homepage":"http://shadowsocks.org/en/download/servers.html","size":6935,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"shadowsocks:master","ref":"master","sha":"f09d280af0a3a60e4e6af9e65c83bda90124e0e0","user":{"login":"shadowsocks","id":3006190,"avatar_url":"https://avatars.githubusercontent.com/u/3006190?v=3","gravatar_id":"","url":"https://api.github.com/users/shadowsocks","html_url":"https://github.com/shadowsocks","followers_url":"https://api.github.com/users/shadowsocks/followers","following_url":"https://api.github.com/users/shadowsocks/following{/other_user}","gists_url":"https://api.github.com/users/shadowsocks/gists{/gist_id}","starred_url":"https://api.github.com/users/shadowsocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shadowsocks/subscriptions","organizations_url":"https://api.github.com/users/shadowsocks/orgs","repos_url":"https://api.github.com/users/shadowsocks/repos","events_url":"https://api.github.com/users/shadowsocks/events{/privacy}","received_events_url":"https://api.github.com/users/shadowsocks/received_events","type":"Organization","site_admin":false},"repo":{"id":7177269,"name":"shadowsocks-libev","full_name":"shadowsocks/shadowsocks-libev","owner":{"login":"shadowsocks","id":3006190,"avatar_url":"https://avatars.githubusercontent.com/u/3006190?v=3","gravatar_id":"","url":"https://api.github.com/users/shadowsocks","html_url":"https://github.com/shadowsocks","followers_url":"https://api.github.com/users/shadowsocks/followers","following_url":"https://api.github.com/users/shadowsocks/following{/other_user}","gists_url":"https://api.github.com/users/shadowsocks/gists{/gist_id}","starred_url":"https://api.github.com/users/shadowsocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shadowsocks/subscriptions","organizations_url":"https://api.github.com/users/shadowsocks/orgs","repos_url":"https://api.github.com/users/shadowsocks/repos","events_url":"https://api.github.com/users/shadowsocks/events{/privacy}","received_events_url":"https://api.github.com/users/shadowsocks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/shadowsocks/shadowsocks-libev","description":"libev port of shadowsocks","fork":true,"url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev","forks_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/forks","keys_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/teams","hooks_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/hooks","issue_events_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/issues/events{/number}","events_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/events","assignees_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/assignees{/user}","branches_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/branches{/branch}","tags_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/tags","blobs_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/git/refs{/sha}","trees_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/statuses/{sha}","languages_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/languages","stargazers_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/stargazers","contributors_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/contributors","subscribers_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/subscribers","subscription_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/subscription","commits_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/commits{/sha}","git_commits_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/git/commits{/sha}","comments_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/comments{/number}","issue_comment_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/issues/comments{/number}","contents_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/contents/{+path}","compare_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/merges","archive_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/downloads","issues_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/issues{/number}","pulls_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/pulls{/number}","milestones_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/milestones{/number}","notifications_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/labels{/name}","releases_url":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/releases{/id}","created_at":"2012-12-15T08:11:07Z","updated_at":"2016-01-01T03:04:01Z","pushed_at":"2016-01-01T02:41:42Z","git_url":"git://github.com/shadowsocks/shadowsocks-libev.git","ssh_url":"git@github.com:shadowsocks/shadowsocks-libev.git","clone_url":"https://github.com/shadowsocks/shadowsocks-libev.git","svn_url":"https://github.com/shadowsocks/shadowsocks-libev","homepage":"http://shadowsocks.org/en/download/servers.html","size":7671,"stargazers_count":2009,"watchers_count":2009,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1613,"mirror_url":null,"open_issues_count":2,"forks":1613,"open_issues":2,"watchers":2009,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/pulls/502"},"html":{"href":"https://github.com/shadowsocks/shadowsocks-libev/pull/502"},"issue":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/issues/502"},"comments":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/issues/502/comments"},"review_comments":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/pulls/502/comments"},"review_comment":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/pulls/502/commits"},"statuses":{"href":"https://api.github.com/repos/shadowsocks/shadowsocks-libev/statuses/a0098cfdb9047a31dd1e5e73f34d429ac366c424"}}}}