{"action":"closed","number":1,"pull_request":{"url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/pulls/1","id":114963509,"html_url":"https://github.com/kriomant/pocketsphinx-rs/pull/1","diff_url":"https://github.com/kriomant/pocketsphinx-rs/pull/1.diff","patch_url":"https://github.com/kriomant/pocketsphinx-rs/pull/1.patch","issue_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/issues/1","number":1,"state":"closed","locked":false,"title":"Fix memory leak of PsDecoder taking a CmdLn config without dropping it","user":{"login":"Paspartout","id":2720369,"avatar_url":"https://avatars3.githubusercontent.com/u/2720369?v=3","gravatar_id":"","url":"https://api.github.com/users/Paspartout","html_url":"https://github.com/Paspartout","followers_url":"https://api.github.com/users/Paspartout/followers","following_url":"https://api.github.com/users/Paspartout/following{/other_user}","gists_url":"https://api.github.com/users/Paspartout/gists{/gist_id}","starred_url":"https://api.github.com/users/Paspartout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Paspartout/subscriptions","organizations_url":"https://api.github.com/users/Paspartout/orgs","repos_url":"https://api.github.com/users/Paspartout/repos","events_url":"https://api.github.com/users/Paspartout/events{/privacy}","received_events_url":"https://api.github.com/users/Paspartout/received_events","type":"User","site_admin":false},"body":"Hey,\r\n\r\nI found a memory leak of your wrapper using valgrind and fixed it to my best knowledge\r\n(I just started learning rust). Maybe you'll find a better way to fix it.\r\n\r\nValgrind output:\r\n\r\n```\r\n==29897== HEAP SUMMARY:\r\n==29897==     in use at exit: 12,498 bytes in 324 blocks\r\n==29897==   total heap usage: 410,308 allocs, 409,984 frees, 147,592,538 bytes allocated\r\n==29897==\r\n==29897== 12,498 (32 direct, 12,466 indirect) bytes in 1 blocks are definitely lost in loss record 50 of 50\r\n==29897==    at 0x4C2CD30: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)\r\n==29897==    by 0x508CE28: __ckd_calloc__ (ckd_alloc.c:157)\r\n==29897==    by 0x5092ACD: cmd_ln_parse_r (cmd_ln.c:564)\r\n==29897==    by 0x114DA9: pocketsphinx::CmdLn::init::hdff10669c9fc8130 (lib.rs:30)\r\n==29897==    by 0x10F826: caia::main::h51224b636fb2dfcf (main.rs:10)\r\n==29897==    by 0x120295: call_once<fn(),()> (ops.rs:2606)\r\n==29897==    by 0x120295: std::panicking::try::do_call::h689a21caeeef92aa (panicking.rs:454)\r\n==29897==    by 0x126DEA: __rust_maybe_catch_panic (lib.rs:98)\r\n==29897==    by 0x120A7A: try<(),fn()> (panicking.rs:433)\r\n==29897==    by 0x120A7A: catch_unwind<fn(),()> (panic.rs:361)\r\n==29897==    by 0x120A7A: std::rt::lang_start::hf63d494cb7dd034c (rt.rs:57)\r\n==29897==    by 0x10F922: main (in /home/paspartout/dev/pro/caia/pt3/caia/target/debug/caia)\r\n==29897==\r\n==29897== LEAK SUMMARY:\r\n==29897==    definitely lost: 32 bytes in 1 blocks\r\n==29897==    indirectly lost: 12,466 bytes in 323 blocks\r\n==29897==      possibly lost: 0 bytes in 0 blocks\r\n==29897==    still reachable: 0 bytes in 0 blocks\r\n==29897==         suppressed: 0 bytes in 0 blocks\r\n==29897==\r\n==29897== For counts of detected and suppressed errors, rerun with: -v\r\n==29897== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)\r\n```\r\n\r\nOnce a the raw config was given to the PsDecoder by ps_init(config.into_raw())\r\nthere was no way to free the memory by dropping the CmdLn anymore.\r\n\r\nThere are also some other warnings by [rust-clippy](https://github.com/Manishearth/rust-clippy) that you might wan't to take a look at.\r\n\r\nThanks for the wrapper though! It helped me understanding how rust does\r\nthe FFI bindings and I am going to use it in a project of mine :+1: .","created_at":"2017-04-08T22:19:11Z","updated_at":"2017-04-12T15:49:04Z","closed_at":"2017-04-12T15:49:04Z","merged_at":"2017-04-12T15:49:04Z","merge_commit_sha":"dae9321a7e58753e95bcfa8bfe81a03f1c6ed8e0","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/pulls/1/commits","review_comments_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/pulls/1/comments","review_comment_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/issues/1/comments","statuses_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/statuses/8f110100cec909f326fcfee40180143abec8b60e","head":{"label":"Paspartout:master","ref":"master","sha":"8f110100cec909f326fcfee40180143abec8b60e","user":{"login":"Paspartout","id":2720369,"avatar_url":"https://avatars3.githubusercontent.com/u/2720369?v=3","gravatar_id":"","url":"https://api.github.com/users/Paspartout","html_url":"https://github.com/Paspartout","followers_url":"https://api.github.com/users/Paspartout/followers","following_url":"https://api.github.com/users/Paspartout/following{/other_user}","gists_url":"https://api.github.com/users/Paspartout/gists{/gist_id}","starred_url":"https://api.github.com/users/Paspartout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Paspartout/subscriptions","organizations_url":"https://api.github.com/users/Paspartout/orgs","repos_url":"https://api.github.com/users/Paspartout/repos","events_url":"https://api.github.com/users/Paspartout/events{/privacy}","received_events_url":"https://api.github.com/users/Paspartout/received_events","type":"User","site_admin":false},"repo":{"id":87666254,"name":"pocketsphinx-rs","full_name":"Paspartout/pocketsphinx-rs","owner":{"login":"Paspartout","id":2720369,"avatar_url":"https://avatars3.githubusercontent.com/u/2720369?v=3","gravatar_id":"","url":"https://api.github.com/users/Paspartout","html_url":"https://github.com/Paspartout","followers_url":"https://api.github.com/users/Paspartout/followers","following_url":"https://api.github.com/users/Paspartout/following{/other_user}","gists_url":"https://api.github.com/users/Paspartout/gists{/gist_id}","starred_url":"https://api.github.com/users/Paspartout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Paspartout/subscriptions","organizations_url":"https://api.github.com/users/Paspartout/orgs","repos_url":"https://api.github.com/users/Paspartout/repos","events_url":"https://api.github.com/users/Paspartout/events{/privacy}","received_events_url":"https://api.github.com/users/Paspartout/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Paspartout/pocketsphinx-rs","description":"Rust wrapper for pocketsphinx","fork":true,"url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs","forks_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/forks","keys_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/teams","hooks_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/hooks","issue_events_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/issues/events{/number}","events_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/events","assignees_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/assignees{/user}","branches_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/branches{/branch}","tags_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/tags","blobs_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/git/refs{/sha}","trees_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/statuses/{sha}","languages_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/languages","stargazers_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/stargazers","contributors_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/contributors","subscribers_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/subscribers","subscription_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/subscription","commits_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/commits{/sha}","git_commits_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/git/commits{/sha}","comments_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/comments{/number}","issue_comment_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/issues/comments{/number}","contents_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/contents/{+path}","compare_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/merges","archive_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/downloads","issues_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/issues{/number}","pulls_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/pulls{/number}","milestones_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/milestones{/number}","notifications_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/labels{/name}","releases_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/releases{/id}","deployments_url":"https://api.github.com/repos/Paspartout/pocketsphinx-rs/deployments","created_at":"2017-04-08T21:47:28Z","updated_at":"2017-04-08T21:47:29Z","pushed_at":"2017-04-09T15:20:57Z","git_url":"git://github.com/Paspartout/pocketsphinx-rs.git","ssh_url":"git@github.com:Paspartout/pocketsphinx-rs.git","clone_url":"https://github.com/Paspartout/pocketsphinx-rs.git","svn_url":"https://github.com/Paspartout/pocketsphinx-rs","homepage":null,"size":16,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"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":"kriomant:master","ref":"master","sha":"b1bd031fea011277de759ff61c65b74e8e468342","user":{"login":"kriomant","id":494406,"avatar_url":"https://avatars0.githubusercontent.com/u/494406?v=3","gravatar_id":"","url":"https://api.github.com/users/kriomant","html_url":"https://github.com/kriomant","followers_url":"https://api.github.com/users/kriomant/followers","following_url":"https://api.github.com/users/kriomant/following{/other_user}","gists_url":"https://api.github.com/users/kriomant/gists{/gist_id}","starred_url":"https://api.github.com/users/kriomant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kriomant/subscriptions","organizations_url":"https://api.github.com/users/kriomant/orgs","repos_url":"https://api.github.com/users/kriomant/repos","events_url":"https://api.github.com/users/kriomant/events{/privacy}","received_events_url":"https://api.github.com/users/kriomant/received_events","type":"User","site_admin":false},"repo":{"id":50447522,"name":"pocketsphinx-rs","full_name":"kriomant/pocketsphinx-rs","owner":{"login":"kriomant","id":494406,"avatar_url":"https://avatars0.githubusercontent.com/u/494406?v=3","gravatar_id":"","url":"https://api.github.com/users/kriomant","html_url":"https://github.com/kriomant","followers_url":"https://api.github.com/users/kriomant/followers","following_url":"https://api.github.com/users/kriomant/following{/other_user}","gists_url":"https://api.github.com/users/kriomant/gists{/gist_id}","starred_url":"https://api.github.com/users/kriomant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kriomant/subscriptions","organizations_url":"https://api.github.com/users/kriomant/orgs","repos_url":"https://api.github.com/users/kriomant/repos","events_url":"https://api.github.com/users/kriomant/events{/privacy}","received_events_url":"https://api.github.com/users/kriomant/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kriomant/pocketsphinx-rs","description":"Rust wrapper for pocketsphinx","fork":false,"url":"https://api.github.com/repos/kriomant/pocketsphinx-rs","forks_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/forks","keys_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/teams","hooks_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/hooks","issue_events_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/issues/events{/number}","events_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/events","assignees_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/assignees{/user}","branches_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/branches{/branch}","tags_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/tags","blobs_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/git/refs{/sha}","trees_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/statuses/{sha}","languages_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/languages","stargazers_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/stargazers","contributors_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/contributors","subscribers_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/subscribers","subscription_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/subscription","commits_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/commits{/sha}","git_commits_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/git/commits{/sha}","comments_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/comments{/number}","issue_comment_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/issues/comments{/number}","contents_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/contents/{+path}","compare_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/merges","archive_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/downloads","issues_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/issues{/number}","pulls_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/pulls{/number}","milestones_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/milestones{/number}","notifications_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/labels{/name}","releases_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/releases{/id}","deployments_url":"https://api.github.com/repos/kriomant/pocketsphinx-rs/deployments","created_at":"2016-01-26T17:52:53Z","updated_at":"2017-04-08T20:47:06Z","pushed_at":"2017-04-12T15:49:04Z","git_url":"git://github.com/kriomant/pocketsphinx-rs.git","ssh_url":"git@github.com:kriomant/pocketsphinx-rs.git","clone_url":"https://github.com/kriomant/pocketsphinx-rs.git","svn_url":"https://github.com/kriomant/pocketsphinx-rs","homepage":null,"size":13,"stargazers_count":6,"watchers_count":6,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":0,"forks":3,"open_issues":0,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kriomant/pocketsphinx-rs/pulls/1"},"html":{"href":"https://github.com/kriomant/pocketsphinx-rs/pull/1"},"issue":{"href":"https://api.github.com/repos/kriomant/pocketsphinx-rs/issues/1"},"comments":{"href":"https://api.github.com/repos/kriomant/pocketsphinx-rs/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/kriomant/pocketsphinx-rs/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/kriomant/pocketsphinx-rs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kriomant/pocketsphinx-rs/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/kriomant/pocketsphinx-rs/statuses/8f110100cec909f326fcfee40180143abec8b60e"}},"merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"kriomant","id":494406,"avatar_url":"https://avatars0.githubusercontent.com/u/494406?v=3","gravatar_id":"","url":"https://api.github.com/users/kriomant","html_url":"https://github.com/kriomant","followers_url":"https://api.github.com/users/kriomant/followers","following_url":"https://api.github.com/users/kriomant/following{/other_user}","gists_url":"https://api.github.com/users/kriomant/gists{/gist_id}","starred_url":"https://api.github.com/users/kriomant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kriomant/subscriptions","organizations_url":"https://api.github.com/users/kriomant/orgs","repos_url":"https://api.github.com/users/kriomant/repos","events_url":"https://api.github.com/users/kriomant/events{/privacy}","received_events_url":"https://api.github.com/users/kriomant/received_events","type":"User","site_admin":false},"comments":0,"review_comments":5,"maintainer_can_modify":false,"commits":2,"additions":2,"deletions":8,"changed_files":1}}
{"actor":{"display_login":"kriomant"}}