{"action":"opened","number":391,"pull_request":{"url":"https://api.github.com/repos/openvenues/libpostal/pulls/391","id":226249315,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI2MjQ5MzE1","html_url":"https://github.com/openvenues/libpostal/pull/391","diff_url":"https://github.com/openvenues/libpostal/pull/391.diff","patch_url":"https://github.com/openvenues/libpostal/pull/391.patch","issue_url":"https://api.github.com/repos/openvenues/libpostal/issues/391","number":391,"state":"open","locked":false,"title":"fix memory leak in setup when datadir is invalid or setup failed","user":{"login":"edding","id":7575584,"node_id":"MDQ6VXNlcjc1NzU1ODQ=","avatar_url":"https://avatars3.githubusercontent.com/u/7575584?v=4","gravatar_id":"","url":"https://api.github.com/users/edding","html_url":"https://github.com/edding","followers_url":"https://api.github.com/users/edding/followers","following_url":"https://api.github.com/users/edding/following{/other_user}","gists_url":"https://api.github.com/users/edding/gists{/gist_id}","starred_url":"https://api.github.com/users/edding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edding/subscriptions","organizations_url":"https://api.github.com/users/edding/orgs","repos_url":"https://api.github.com/users/edding/repos","events_url":"https://api.github.com/users/edding/events{/privacy}","received_events_url":"https://api.github.com/users/edding/received_events","type":"User","site_admin":false},"body":"I found this leak when passing an invalid datadir to setup. I'm running on 1.0.0 but it seems this issue still exists on master:\r\n\r\n```\r\nERR   Error loading transliteration module, dir=/fake/datadir/transliteration/transliteration.dat\r\n   at libpostal_setup_datadir (libpostal.c:1047) errno: No such file or directory\r\nWARNING: Logging before InitGoogleLogging() is written to STDERR\r\nERR   parser is not setup, call libpostal_setup_address_parser()\r\n   at address_parser_parse (address_parser.c:1659) errno: No such file or directory\r\nERR   Parser returned NULL\r\n   at libpostal_parse_address (libpostal.c:1027) errno: No such file or directory\r\n\r\n=================================================================\r\n==4194251==ERROR: LeakSanitizer: detected memory leaks\r\n\r\nDirect leak of 128 byte(s) in 1 object(s) allocated from:\r\n    #0 0x4f7e90 in realloc (/data/users/jdedward/libpostal_wrapper_test+0x4f7e90)\r\n    #1 0x7f3c6803b929 in char_array_push /home/libpostal/1.0.0/src/libpostal-1.0.0/src/collections.h:50\r\n    #2 0x7f3c6803b929 in char_array_append_len /home/libpostal/1.0.0/src/libpostal-1.0.0/src/string_utils.c:673\r\n    #3 0x7f3c6803b929 in char_array_add_vjoined /home/libpostal/1.0.0/src/libpostal-1.0.0/src/string_utils.c:757\r\n    #4 0x7f3c6803db58 in path_vjoin /home/libpostal/1.0.0/src/libpostal-1.0.0/src/file_utils.c:49\r\n    #5 0x7f3c6803dc0a in path_join /home/libpostal/1.0.0/src/libpostal-1.0.0/src/file_utils.c:56\r\n    #6 0x7f3c6802a393 in libpostal_setup_datadir /home/libpostal/1.0.0/src/libpostal-1.0.0/src/libpostal.c:1042\r\n...\r\n\r\nDirect leak of 128 byte(s) in 1 object(s) allocated from:\r\n    #0 0x4f7e90 in realloc (/data/users/jdedward/libpostal_wrapper_test+0x4f7e90)\r\n    #1 0x7f3c6803b929 in char_array_push /home/libpostal/1.0.0/src/libpostal-1.0.0/src/collections.h:50\r\n    #2 0x7f3c6803b929 in char_array_append_len /home/libpostal/1.0.0/src/libpostal-1.0.0/src/string_utils.c:673\r\n    #3 0x7f3c6803b929 in char_array_add_vjoined /home/libpostal/1.0.0/src/libpostal-1.0.0/src/string_utils.c:757\r\n    #4 0x7f3c6803db58 in path_vjoin /home/libpostal/1.0.0/src/libpostal-1.0.0/src/file_utils.c:49\r\n    #5 0x7f3c6803dc0a in path_join /home/libpostal/1.0.0/src/libpostal-1.0.0/src/file_utils.c:56\r\n    #6 0x7f3c6802a3b3 in libpostal_setup_datadir /home/libpostal/1.0.0/src/libpostal-1.0.0/src/libpostal.c:1043\r\n...\r\n\r\nDirect leak of 128 byte(s) in 1 object(s) allocated from:\r\n    #0 0x4f7e90 in realloc (/data/users/jdedward/libpostal_wrapper_test+0x4f7e90)\r\n    #1 0x7f3c6803b929 in char_array_push /home/libpostal/1.0.0/src/libpostal-1.0.0/src/collections.h:50\r\n    #2 0x7f3c6803b929 in char_array_append_len /home/libpostal/1.0.0/src/libpostal-1.0.0/src/string_utils.c:673\r\n    #3 0x7f3c6803b929 in char_array_add_vjoined /home/libpostal/1.0.0/src/libpostal-1.0.0/src/string_utils.c:757\r\n    #4 0x7f3c6803db58 in path_vjoin /home/libpostal/1.0.0/src/libpostal-1.0.0/src/file_utils.c:49\r\n    #5 0x7f3c6803dc0a in path_join /home/libpostal/1.0.0/src/libpostal-1.0.0/src/file_utils.c:56\r\n    #6 0x7f3c6802a373 in libpostal_setup_datadir /home/libpostal/1.0.0/src/libpostal-1.0.0/src/libpostal.c:1041\r\n...\r\n```","created_at":"2018-10-26T23:20:05Z","updated_at":"2018-10-26T23:20:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/openvenues/libpostal/pulls/391/commits","review_comments_url":"https://api.github.com/repos/openvenues/libpostal/pulls/391/comments","review_comment_url":"https://api.github.com/repos/openvenues/libpostal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openvenues/libpostal/issues/391/comments","statuses_url":"https://api.github.com/repos/openvenues/libpostal/statuses/363e83304a6facb733b0cc5a505bd23930d54116","head":{"label":"edding:fix_memory_leak","ref":"fix_memory_leak","sha":"363e83304a6facb733b0cc5a505bd23930d54116","user":{"login":"edding","id":7575584,"node_id":"MDQ6VXNlcjc1NzU1ODQ=","avatar_url":"https://avatars3.githubusercontent.com/u/7575584?v=4","gravatar_id":"","url":"https://api.github.com/users/edding","html_url":"https://github.com/edding","followers_url":"https://api.github.com/users/edding/followers","following_url":"https://api.github.com/users/edding/following{/other_user}","gists_url":"https://api.github.com/users/edding/gists{/gist_id}","starred_url":"https://api.github.com/users/edding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edding/subscriptions","organizations_url":"https://api.github.com/users/edding/orgs","repos_url":"https://api.github.com/users/edding/repos","events_url":"https://api.github.com/users/edding/events{/privacy}","received_events_url":"https://api.github.com/users/edding/received_events","type":"User","site_admin":false},"repo":{"id":154899291,"node_id":"MDEwOlJlcG9zaXRvcnkxNTQ4OTkyOTE=","name":"libpostal","full_name":"edding/libpostal","private":false,"owner":{"login":"edding","id":7575584,"node_id":"MDQ6VXNlcjc1NzU1ODQ=","avatar_url":"https://avatars3.githubusercontent.com/u/7575584?v=4","gravatar_id":"","url":"https://api.github.com/users/edding","html_url":"https://github.com/edding","followers_url":"https://api.github.com/users/edding/followers","following_url":"https://api.github.com/users/edding/following{/other_user}","gists_url":"https://api.github.com/users/edding/gists{/gist_id}","starred_url":"https://api.github.com/users/edding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edding/subscriptions","organizations_url":"https://api.github.com/users/edding/orgs","repos_url":"https://api.github.com/users/edding/repos","events_url":"https://api.github.com/users/edding/events{/privacy}","received_events_url":"https://api.github.com/users/edding/received_events","type":"User","site_admin":false},"html_url":"https://github.com/edding/libpostal","description":"A C library for parsing/normalizing street addresses around the world. Powered by statistical NLP and open geo data.","fork":true,"url":"https://api.github.com/repos/edding/libpostal","forks_url":"https://api.github.com/repos/edding/libpostal/forks","keys_url":"https://api.github.com/repos/edding/libpostal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/edding/libpostal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/edding/libpostal/teams","hooks_url":"https://api.github.com/repos/edding/libpostal/hooks","issue_events_url":"https://api.github.com/repos/edding/libpostal/issues/events{/number}","events_url":"https://api.github.com/repos/edding/libpostal/events","assignees_url":"https://api.github.com/repos/edding/libpostal/assignees{/user}","branches_url":"https://api.github.com/repos/edding/libpostal/branches{/branch}","tags_url":"https://api.github.com/repos/edding/libpostal/tags","blobs_url":"https://api.github.com/repos/edding/libpostal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/edding/libpostal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/edding/libpostal/git/refs{/sha}","trees_url":"https://api.github.com/repos/edding/libpostal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/edding/libpostal/statuses/{sha}","languages_url":"https://api.github.com/repos/edding/libpostal/languages","stargazers_url":"https://api.github.com/repos/edding/libpostal/stargazers","contributors_url":"https://api.github.com/repos/edding/libpostal/contributors","subscribers_url":"https://api.github.com/repos/edding/libpostal/subscribers","subscription_url":"https://api.github.com/repos/edding/libpostal/subscription","commits_url":"https://api.github.com/repos/edding/libpostal/commits{/sha}","git_commits_url":"https://api.github.com/repos/edding/libpostal/git/commits{/sha}","comments_url":"https://api.github.com/repos/edding/libpostal/comments{/number}","issue_comment_url":"https://api.github.com/repos/edding/libpostal/issues/comments{/number}","contents_url":"https://api.github.com/repos/edding/libpostal/contents/{+path}","compare_url":"https://api.github.com/repos/edding/libpostal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/edding/libpostal/merges","archive_url":"https://api.github.com/repos/edding/libpostal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/edding/libpostal/downloads","issues_url":"https://api.github.com/repos/edding/libpostal/issues{/number}","pulls_url":"https://api.github.com/repos/edding/libpostal/pulls{/number}","milestones_url":"https://api.github.com/repos/edding/libpostal/milestones{/number}","notifications_url":"https://api.github.com/repos/edding/libpostal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/edding/libpostal/labels{/name}","releases_url":"https://api.github.com/repos/edding/libpostal/releases{/id}","deployments_url":"https://api.github.com/repos/edding/libpostal/deployments","created_at":"2018-10-26T22:05:03Z","updated_at":"2018-10-26T22:05:07Z","pushed_at":"2018-10-26T23:08:38Z","git_url":"git://github.com/edding/libpostal.git","ssh_url":"git@github.com:edding/libpostal.git","clone_url":"https://github.com/edding/libpostal.git","svn_url":"https://github.com/edding/libpostal","homepage":"","size":37624,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openvenues:master","ref":"master","sha":"eae01d3e60501978d880e4ded15783daa28de7e5","user":{"login":"openvenues","id":8659384,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2NTkzODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/8659384?v=4","gravatar_id":"","url":"https://api.github.com/users/openvenues","html_url":"https://github.com/openvenues","followers_url":"https://api.github.com/users/openvenues/followers","following_url":"https://api.github.com/users/openvenues/following{/other_user}","gists_url":"https://api.github.com/users/openvenues/gists{/gist_id}","starred_url":"https://api.github.com/users/openvenues/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openvenues/subscriptions","organizations_url":"https://api.github.com/users/openvenues/orgs","repos_url":"https://api.github.com/users/openvenues/repos","events_url":"https://api.github.com/users/openvenues/events{/privacy}","received_events_url":"https://api.github.com/users/openvenues/received_events","type":"Organization","site_admin":false},"repo":{"id":31570906,"node_id":"MDEwOlJlcG9zaXRvcnkzMTU3MDkwNg==","name":"libpostal","full_name":"openvenues/libpostal","private":false,"owner":{"login":"openvenues","id":8659384,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg2NTkzODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/8659384?v=4","gravatar_id":"","url":"https://api.github.com/users/openvenues","html_url":"https://github.com/openvenues","followers_url":"https://api.github.com/users/openvenues/followers","following_url":"https://api.github.com/users/openvenues/following{/other_user}","gists_url":"https://api.github.com/users/openvenues/gists{/gist_id}","starred_url":"https://api.github.com/users/openvenues/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openvenues/subscriptions","organizations_url":"https://api.github.com/users/openvenues/orgs","repos_url":"https://api.github.com/users/openvenues/repos","events_url":"https://api.github.com/users/openvenues/events{/privacy}","received_events_url":"https://api.github.com/users/openvenues/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/openvenues/libpostal","description":"A C library for parsing/normalizing street addresses around the world. Powered by statistical NLP and open geo data.","fork":false,"url":"https://api.github.com/repos/openvenues/libpostal","forks_url":"https://api.github.com/repos/openvenues/libpostal/forks","keys_url":"https://api.github.com/repos/openvenues/libpostal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openvenues/libpostal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openvenues/libpostal/teams","hooks_url":"https://api.github.com/repos/openvenues/libpostal/hooks","issue_events_url":"https://api.github.com/repos/openvenues/libpostal/issues/events{/number}","events_url":"https://api.github.com/repos/openvenues/libpostal/events","assignees_url":"https://api.github.com/repos/openvenues/libpostal/assignees{/user}","branches_url":"https://api.github.com/repos/openvenues/libpostal/branches{/branch}","tags_url":"https://api.github.com/repos/openvenues/libpostal/tags","blobs_url":"https://api.github.com/repos/openvenues/libpostal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openvenues/libpostal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openvenues/libpostal/git/refs{/sha}","trees_url":"https://api.github.com/repos/openvenues/libpostal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openvenues/libpostal/statuses/{sha}","languages_url":"https://api.github.com/repos/openvenues/libpostal/languages","stargazers_url":"https://api.github.com/repos/openvenues/libpostal/stargazers","contributors_url":"https://api.github.com/repos/openvenues/libpostal/contributors","subscribers_url":"https://api.github.com/repos/openvenues/libpostal/subscribers","subscription_url":"https://api.github.com/repos/openvenues/libpostal/subscription","commits_url":"https://api.github.com/repos/openvenues/libpostal/commits{/sha}","git_commits_url":"https://api.github.com/repos/openvenues/libpostal/git/commits{/sha}","comments_url":"https://api.github.com/repos/openvenues/libpostal/comments{/number}","issue_comment_url":"https://api.github.com/repos/openvenues/libpostal/issues/comments{/number}","contents_url":"https://api.github.com/repos/openvenues/libpostal/contents/{+path}","compare_url":"https://api.github.com/repos/openvenues/libpostal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openvenues/libpostal/merges","archive_url":"https://api.github.com/repos/openvenues/libpostal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openvenues/libpostal/downloads","issues_url":"https://api.github.com/repos/openvenues/libpostal/issues{/number}","pulls_url":"https://api.github.com/repos/openvenues/libpostal/pulls{/number}","milestones_url":"https://api.github.com/repos/openvenues/libpostal/milestones{/number}","notifications_url":"https://api.github.com/repos/openvenues/libpostal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openvenues/libpostal/labels{/name}","releases_url":"https://api.github.com/repos/openvenues/libpostal/releases{/id}","deployments_url":"https://api.github.com/repos/openvenues/libpostal/deployments","created_at":"2015-03-03T00:21:31Z","updated_at":"2018-10-26T19:45:13Z","pushed_at":"2018-08-14T10:26:42Z","git_url":"git://github.com/openvenues/libpostal.git","ssh_url":"git@github.com:openvenues/libpostal.git","clone_url":"https://github.com/openvenues/libpostal.git","svn_url":"https://github.com/openvenues/libpostal","homepage":"","size":37626,"stargazers_count":1577,"watchers_count":1577,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":169,"mirror_url":null,"archived":false,"open_issues_count":132,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":169,"open_issues":132,"watchers":1577,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openvenues/libpostal/pulls/391"},"html":{"href":"https://github.com/openvenues/libpostal/pull/391"},"issue":{"href":"https://api.github.com/repos/openvenues/libpostal/issues/391"},"comments":{"href":"https://api.github.com/repos/openvenues/libpostal/issues/391/comments"},"review_comments":{"href":"https://api.github.com/repos/openvenues/libpostal/pulls/391/comments"},"review_comment":{"href":"https://api.github.com/repos/openvenues/libpostal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openvenues/libpostal/pulls/391/commits"},"statuses":{"href":"https://api.github.com/repos/openvenues/libpostal/statuses/363e83304a6facb733b0cc5a505bd23930d54116"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":8,"deletions":6,"changed_files":1}}
{"actor":{"display_login":"edding"}}