{"action":"created","comment":{"url":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/comments/143394588","pull_request_review_id":67898939,"id":143394588,"diff_hunk":"@@ -132,27 +133,29 @@ int main( int argc, char *argv[] )\n     mbedtls_printf( \"\\n  . Decrypting the encrypted data\" );\n     fflush( stdout );\n \n-    if( ( ret = mbedtls_pk_decrypt( &pk, buf, i, result, &olen, sizeof(result),\n-                            mbedtls_ctr_drbg_random, &ctr_drbg ) ) != 0 )\n+    if( ( ret = mbedtls_pk_decrypt( &pk, buf, i, result, &olen,\n+                                    sizeof( result ), mbedtls_ctr_drbg_random,\n+                                    &ctr_drbg ) ) != 0 )\n     {\n-        mbedtls_printf( \" failed\\n  ! mbedtls_pk_decrypt returned -0x%04x\\n\", -ret );\n+        mbedtls_printf( \" failed\\n  ! mbedtls_pk_decrypt returned -0x%04x\\n\",\n+                        -ret );\n         goto exit;\n     }\n \n     mbedtls_printf( \"\\n  . OK\\n\\n\" );\n \n     mbedtls_printf( \"The decrypted result is: '%s'\\n\\n\", result );\n-\n     ret = 0;\n \n exit:\n+    mbedtls_pk_free( &pk );","path":"programs/pkey/pk_decrypt.c","position":101,"original_position":101,"commit_id":"71e57132768a02f22d4be874cfa5e32c36dc6b90","original_commit_id":"71e57132768a02f22d4be874cfa5e32c36dc6b90","user":{"login":"hanno-arm","id":26892988,"avatar_url":"https://avatars1.githubusercontent.com/u/26892988?v=4","gravatar_id":"","url":"https://api.github.com/users/hanno-arm","html_url":"https://github.com/hanno-arm","followers_url":"https://api.github.com/users/hanno-arm/followers","following_url":"https://api.github.com/users/hanno-arm/following{/other_user}","gists_url":"https://api.github.com/users/hanno-arm/gists{/gist_id}","starred_url":"https://api.github.com/users/hanno-arm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanno-arm/subscriptions","organizations_url":"https://api.github.com/users/hanno-arm/orgs","repos_url":"https://api.github.com/users/hanno-arm/repos","events_url":"https://api.github.com/users/hanno-arm/events{/privacy}","received_events_url":"https://api.github.com/users/hanno-arm/received_events","type":"User","site_admin":false},"body":"@RonEld Thanks for pointing that out! I agree that this is a valuable rule to adhere to.","created_at":"2017-10-09T07:07:32Z","updated_at":"2017-10-09T07:07:32Z","html_url":"https://github.com/ARMmbed/mbedtls/pull/1129#discussion_r143394588","pull_request_url":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1129","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/comments/143394588"},"html":{"href":"https://github.com/ARMmbed/mbedtls/pull/1129#discussion_r143394588"},"pull_request":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1129"}},"in_reply_to_id":143393735},"pull_request":{"url":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1129","id":145340955,"html_url":"https://github.com/ARMmbed/mbedtls/pull/1129","diff_url":"https://github.com/ARMmbed/mbedtls/pull/1129.diff","patch_url":"https://github.com/ARMmbed/mbedtls/pull/1129.patch","issue_url":"https://api.github.com/repos/ARMmbed/mbedtls/issues/1129","number":1129,"state":"open","locked":false,"title":"Memory leak in example programs pk_encrypt and pk_decrypt","user":{"login":"hanno-arm","id":26892988,"avatar_url":"https://avatars1.githubusercontent.com/u/26892988?v=4","gravatar_id":"","url":"https://api.github.com/users/hanno-arm","html_url":"https://github.com/hanno-arm","followers_url":"https://api.github.com/users/hanno-arm/followers","following_url":"https://api.github.com/users/hanno-arm/following{/other_user}","gists_url":"https://api.github.com/users/hanno-arm/gists{/gist_id}","starred_url":"https://api.github.com/users/hanno-arm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanno-arm/subscriptions","organizations_url":"https://api.github.com/users/hanno-arm/orgs","repos_url":"https://api.github.com/users/hanno-arm/repos","events_url":"https://api.github.com/users/hanno-arm/events{/privacy}","received_events_url":"https://api.github.com/users/hanno-arm/received_events","type":"User","site_admin":false},"body":"__Summary:__ This PR fixes the #1128 on memory leaks and free-without-initialization in the example program `pk_encrypt`. The same issue was found to exist `pk_decrypt` and is also fixed. Also, some minor style improvements have been made along the way.","created_at":"2017-10-08T16:00:21Z","updated_at":"2017-10-09T07:07:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a1686a989f9f089b45b384bd6586d0eb691b0dfd","assignee":null,"assignees":[],"requested_reviewers":[{"login":"andresag01","id":3746901,"avatar_url":"https://avatars3.githubusercontent.com/u/3746901?v=4","gravatar_id":"","url":"https://api.github.com/users/andresag01","html_url":"https://github.com/andresag01","followers_url":"https://api.github.com/users/andresag01/followers","following_url":"https://api.github.com/users/andresag01/following{/other_user}","gists_url":"https://api.github.com/users/andresag01/gists{/gist_id}","starred_url":"https://api.github.com/users/andresag01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andresag01/subscriptions","organizations_url":"https://api.github.com/users/andresag01/orgs","repos_url":"https://api.github.com/users/andresag01/repos","events_url":"https://api.github.com/users/andresag01/events{/privacy}","received_events_url":"https://api.github.com/users/andresag01/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1129/commits","review_comments_url":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1129/comments","review_comment_url":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ARMmbed/mbedtls/issues/1129/comments","statuses_url":"https://api.github.com/repos/ARMmbed/mbedtls/statuses/71e57132768a02f22d4be874cfa5e32c36dc6b90","head":{"label":"hanno-arm:github-1128","ref":"github-1128","sha":"71e57132768a02f22d4be874cfa5e32c36dc6b90","user":{"login":"hanno-arm","id":26892988,"avatar_url":"https://avatars1.githubusercontent.com/u/26892988?v=4","gravatar_id":"","url":"https://api.github.com/users/hanno-arm","html_url":"https://github.com/hanno-arm","followers_url":"https://api.github.com/users/hanno-arm/followers","following_url":"https://api.github.com/users/hanno-arm/following{/other_user}","gists_url":"https://api.github.com/users/hanno-arm/gists{/gist_id}","starred_url":"https://api.github.com/users/hanno-arm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanno-arm/subscriptions","organizations_url":"https://api.github.com/users/hanno-arm/orgs","repos_url":"https://api.github.com/users/hanno-arm/repos","events_url":"https://api.github.com/users/hanno-arm/events{/privacy}","received_events_url":"https://api.github.com/users/hanno-arm/received_events","type":"User","site_admin":false},"repo":{"id":87815731,"name":"mbedtls","full_name":"hanno-arm/mbedtls","owner":{"login":"hanno-arm","id":26892988,"avatar_url":"https://avatars1.githubusercontent.com/u/26892988?v=4","gravatar_id":"","url":"https://api.github.com/users/hanno-arm","html_url":"https://github.com/hanno-arm","followers_url":"https://api.github.com/users/hanno-arm/followers","following_url":"https://api.github.com/users/hanno-arm/following{/other_user}","gists_url":"https://api.github.com/users/hanno-arm/gists{/gist_id}","starred_url":"https://api.github.com/users/hanno-arm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanno-arm/subscriptions","organizations_url":"https://api.github.com/users/hanno-arm/orgs","repos_url":"https://api.github.com/users/hanno-arm/repos","events_url":"https://api.github.com/users/hanno-arm/events{/privacy}","received_events_url":"https://api.github.com/users/hanno-arm/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hanno-arm/mbedtls","description":"An open source, portable, easy to use, readable and flexible SSL library","fork":true,"url":"https://api.github.com/repos/hanno-arm/mbedtls","forks_url":"https://api.github.com/repos/hanno-arm/mbedtls/forks","keys_url":"https://api.github.com/repos/hanno-arm/mbedtls/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hanno-arm/mbedtls/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hanno-arm/mbedtls/teams","hooks_url":"https://api.github.com/repos/hanno-arm/mbedtls/hooks","issue_events_url":"https://api.github.com/repos/hanno-arm/mbedtls/issues/events{/number}","events_url":"https://api.github.com/repos/hanno-arm/mbedtls/events","assignees_url":"https://api.github.com/repos/hanno-arm/mbedtls/assignees{/user}","branches_url":"https://api.github.com/repos/hanno-arm/mbedtls/branches{/branch}","tags_url":"https://api.github.com/repos/hanno-arm/mbedtls/tags","blobs_url":"https://api.github.com/repos/hanno-arm/mbedtls/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hanno-arm/mbedtls/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hanno-arm/mbedtls/git/refs{/sha}","trees_url":"https://api.github.com/repos/hanno-arm/mbedtls/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hanno-arm/mbedtls/statuses/{sha}","languages_url":"https://api.github.com/repos/hanno-arm/mbedtls/languages","stargazers_url":"https://api.github.com/repos/hanno-arm/mbedtls/stargazers","contributors_url":"https://api.github.com/repos/hanno-arm/mbedtls/contributors","subscribers_url":"https://api.github.com/repos/hanno-arm/mbedtls/subscribers","subscription_url":"https://api.github.com/repos/hanno-arm/mbedtls/subscription","commits_url":"https://api.github.com/repos/hanno-arm/mbedtls/commits{/sha}","git_commits_url":"https://api.github.com/repos/hanno-arm/mbedtls/git/commits{/sha}","comments_url":"https://api.github.com/repos/hanno-arm/mbedtls/comments{/number}","issue_comment_url":"https://api.github.com/repos/hanno-arm/mbedtls/issues/comments{/number}","contents_url":"https://api.github.com/repos/hanno-arm/mbedtls/contents/{+path}","compare_url":"https://api.github.com/repos/hanno-arm/mbedtls/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hanno-arm/mbedtls/merges","archive_url":"https://api.github.com/repos/hanno-arm/mbedtls/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hanno-arm/mbedtls/downloads","issues_url":"https://api.github.com/repos/hanno-arm/mbedtls/issues{/number}","pulls_url":"https://api.github.com/repos/hanno-arm/mbedtls/pulls{/number}","milestones_url":"https://api.github.com/repos/hanno-arm/mbedtls/milestones{/number}","notifications_url":"https://api.github.com/repos/hanno-arm/mbedtls/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hanno-arm/mbedtls/labels{/name}","releases_url":"https://api.github.com/repos/hanno-arm/mbedtls/releases{/id}","deployments_url":"https://api.github.com/repos/hanno-arm/mbedtls/deployments","created_at":"2017-04-10T13:44:55Z","updated_at":"2017-04-10T13:45:00Z","pushed_at":"2017-10-08T15:54:10Z","git_url":"git://github.com/hanno-arm/mbedtls.git","ssh_url":"git@github.com:hanno-arm/mbedtls.git","clone_url":"https://github.com/hanno-arm/mbedtls.git","svn_url":"https://github.com/hanno-arm/mbedtls","homepage":"https://tls.mbed.org","size":23024,"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,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"development"}},"base":{"label":"ARMmbed:development","ref":"development","sha":"86968c6dd1d5b272de78060a6dca7f7f2f961574","user":{"login":"ARMmbed","id":8916057,"avatar_url":"https://avatars3.githubusercontent.com/u/8916057?v=4","gravatar_id":"","url":"https://api.github.com/users/ARMmbed","html_url":"https://github.com/ARMmbed","followers_url":"https://api.github.com/users/ARMmbed/followers","following_url":"https://api.github.com/users/ARMmbed/following{/other_user}","gists_url":"https://api.github.com/users/ARMmbed/gists{/gist_id}","starred_url":"https://api.github.com/users/ARMmbed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARMmbed/subscriptions","organizations_url":"https://api.github.com/users/ARMmbed/orgs","repos_url":"https://api.github.com/users/ARMmbed/repos","events_url":"https://api.github.com/users/ARMmbed/events{/privacy}","received_events_url":"https://api.github.com/users/ARMmbed/received_events","type":"Organization","site_admin":false},"repo":{"id":6687936,"name":"mbedtls","full_name":"ARMmbed/mbedtls","owner":{"login":"ARMmbed","id":8916057,"avatar_url":"https://avatars3.githubusercontent.com/u/8916057?v=4","gravatar_id":"","url":"https://api.github.com/users/ARMmbed","html_url":"https://github.com/ARMmbed","followers_url":"https://api.github.com/users/ARMmbed/followers","following_url":"https://api.github.com/users/ARMmbed/following{/other_user}","gists_url":"https://api.github.com/users/ARMmbed/gists{/gist_id}","starred_url":"https://api.github.com/users/ARMmbed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ARMmbed/subscriptions","organizations_url":"https://api.github.com/users/ARMmbed/orgs","repos_url":"https://api.github.com/users/ARMmbed/repos","events_url":"https://api.github.com/users/ARMmbed/events{/privacy}","received_events_url":"https://api.github.com/users/ARMmbed/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ARMmbed/mbedtls","description":"An open source, portable, easy to use, readable and flexible SSL library","fork":false,"url":"https://api.github.com/repos/ARMmbed/mbedtls","forks_url":"https://api.github.com/repos/ARMmbed/mbedtls/forks","keys_url":"https://api.github.com/repos/ARMmbed/mbedtls/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ARMmbed/mbedtls/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ARMmbed/mbedtls/teams","hooks_url":"https://api.github.com/repos/ARMmbed/mbedtls/hooks","issue_events_url":"https://api.github.com/repos/ARMmbed/mbedtls/issues/events{/number}","events_url":"https://api.github.com/repos/ARMmbed/mbedtls/events","assignees_url":"https://api.github.com/repos/ARMmbed/mbedtls/assignees{/user}","branches_url":"https://api.github.com/repos/ARMmbed/mbedtls/branches{/branch}","tags_url":"https://api.github.com/repos/ARMmbed/mbedtls/tags","blobs_url":"https://api.github.com/repos/ARMmbed/mbedtls/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ARMmbed/mbedtls/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ARMmbed/mbedtls/git/refs{/sha}","trees_url":"https://api.github.com/repos/ARMmbed/mbedtls/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ARMmbed/mbedtls/statuses/{sha}","languages_url":"https://api.github.com/repos/ARMmbed/mbedtls/languages","stargazers_url":"https://api.github.com/repos/ARMmbed/mbedtls/stargazers","contributors_url":"https://api.github.com/repos/ARMmbed/mbedtls/contributors","subscribers_url":"https://api.github.com/repos/ARMmbed/mbedtls/subscribers","subscription_url":"https://api.github.com/repos/ARMmbed/mbedtls/subscription","commits_url":"https://api.github.com/repos/ARMmbed/mbedtls/commits{/sha}","git_commits_url":"https://api.github.com/repos/ARMmbed/mbedtls/git/commits{/sha}","comments_url":"https://api.github.com/repos/ARMmbed/mbedtls/comments{/number}","issue_comment_url":"https://api.github.com/repos/ARMmbed/mbedtls/issues/comments{/number}","contents_url":"https://api.github.com/repos/ARMmbed/mbedtls/contents/{+path}","compare_url":"https://api.github.com/repos/ARMmbed/mbedtls/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ARMmbed/mbedtls/merges","archive_url":"https://api.github.com/repos/ARMmbed/mbedtls/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ARMmbed/mbedtls/downloads","issues_url":"https://api.github.com/repos/ARMmbed/mbedtls/issues{/number}","pulls_url":"https://api.github.com/repos/ARMmbed/mbedtls/pulls{/number}","milestones_url":"https://api.github.com/repos/ARMmbed/mbedtls/milestones{/number}","notifications_url":"https://api.github.com/repos/ARMmbed/mbedtls/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ARMmbed/mbedtls/labels{/name}","releases_url":"https://api.github.com/repos/ARMmbed/mbedtls/releases{/id}","deployments_url":"https://api.github.com/repos/ARMmbed/mbedtls/deployments","created_at":"2012-11-14T13:13:13Z","updated_at":"2017-10-05T02:15:26Z","pushed_at":"2017-10-08T17:56:58Z","git_url":"git://github.com/ARMmbed/mbedtls.git","ssh_url":"git@github.com:ARMmbed/mbedtls.git","clone_url":"https://github.com/ARMmbed/mbedtls.git","svn_url":"https://github.com/ARMmbed/mbedtls","homepage":"https://tls.mbed.org","size":22348,"stargazers_count":1091,"watchers_count":1091,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":655,"mirror_url":null,"open_issues_count":386,"forks":655,"open_issues":386,"watchers":1091,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1129"},"html":{"href":"https://github.com/ARMmbed/mbedtls/pull/1129"},"issue":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/issues/1129"},"comments":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/issues/1129/comments"},"review_comments":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1129/comments"},"review_comment":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/pulls/1129/commits"},"statuses":{"href":"https://api.github.com/repos/ARMmbed/mbedtls/statuses/71e57132768a02f22d4be874cfa5e32c36dc6b90"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"hanno-arm"}}