{"action":"created","comment":{"url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/comments/221439969","pull_request_review_id":160093749,"id":221439969,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTQzOTk2OQ==","diff_hunk":"@@ -528,14 +528,8 @@ static void copy_tl(struct tag_entry *st, struct tag_entry *dt)\n \t\t*_dptr = 0;                              \\\n \t}\n \n-/* copy_dive makes duplicates of many components of a dive;\n- * in order not to leak memory, we need to free those .\n- * copy_dive doesn't play with the divetrip and forward/backward pointers\n- * so we can ignore those */\n-void clear_dive(struct dive *d)\n+static void free_dive_structures(struct dive *d)\n {\n-\tif (!d)\n-\t\treturn;","path":"core/dive.c","position":null,"original_position":12,"commit_id":"b409e86d52aca78d5853bd2674a15da92f6f6f27","original_commit_id":"10ea6bb5d0835a589f573930f816a69dcec4d14b","user":{"login":"dirkhh","id":237471,"node_id":"MDQ6VXNlcjIzNzQ3MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/237471?v=4","gravatar_id":"","url":"https://api.github.com/users/dirkhh","html_url":"https://github.com/dirkhh","followers_url":"https://api.github.com/users/dirkhh/followers","following_url":"https://api.github.com/users/dirkhh/following{/other_user}","gists_url":"https://api.github.com/users/dirkhh/gists{/gist_id}","starred_url":"https://api.github.com/users/dirkhh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dirkhh/subscriptions","organizations_url":"https://api.github.com/users/dirkhh/orgs","repos_url":"https://api.github.com/users/dirkhh/repos","events_url":"https://api.github.com/users/dirkhh/events{/privacy}","received_events_url":"https://api.github.com/users/dirkhh/received_events","type":"User","site_admin":false},"body":"hehe... you're not paying attention. The release is out :-)","created_at":"2018-09-29T21:11:11Z","updated_at":"2018-09-29T21:11:11Z","html_url":"https://github.com/Subsurface-divelog/subsurface/pull/1732#discussion_r221439969","pull_request_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1732","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/comments/221439969"},"html":{"href":"https://github.com/Subsurface-divelog/subsurface/pull/1732#discussion_r221439969"},"pull_request":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1732"}},"in_reply_to_id":221439811},"pull_request":{"url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1732","id":219131261,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5MTMxMjYx","html_url":"https://github.com/Subsurface-divelog/subsurface/pull/1732","diff_url":"https://github.com/Subsurface-divelog/subsurface/pull/1732.diff","patch_url":"https://github.com/Subsurface-divelog/subsurface/pull/1732.patch","issue_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues/1732","number":1732,"state":"open","locked":false,"title":"Cleanup: split out free_dive() function from delete_single_dive() [Leak fix?]","user":{"login":"bstoeger","id":32835590,"node_id":"MDQ6VXNlcjMyODM1NTkw","avatar_url":"https://avatars3.githubusercontent.com/u/32835590?v=4","gravatar_id":"","url":"https://api.github.com/users/bstoeger","html_url":"https://github.com/bstoeger","followers_url":"https://api.github.com/users/bstoeger/followers","following_url":"https://api.github.com/users/bstoeger/following{/other_user}","gists_url":"https://api.github.com/users/bstoeger/gists{/gist_id}","starred_url":"https://api.github.com/users/bstoeger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bstoeger/subscriptions","organizations_url":"https://api.github.com/users/bstoeger/orgs","repos_url":"https://api.github.com/users/bstoeger/repos","events_url":"https://api.github.com/users/bstoeger/events{/privacy}","received_events_url":"https://api.github.com/users/bstoeger/received_events","type":"User","site_admin":false},"body":"Currently, we can only delete dives that are indexed in the main\r\ndive table. In the future, we will have to delete dives outside\r\nof this table (e.g. for undo). Therefore, split out the free_dive()\r\nfunction from delete_single_dive(), which takes an index into\r\nthe main dive table.\r\n\r\nIn the process, adopt the dive freeing-code from clear_dive(),\r\nwhich frees more data than the code in delete_single_dive().\r\nThis potentially fixes a memory-leak.\r\n\r\nSigned-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>\r\n\r\n<!-- Lines like this one are comments and will not be shown in the final output. -->\r\n<!-- Make sure that you have read the \"Contributing\" section of the README and also the notes in CodingStyle. -->\r\n<!-- If you are a collaborator, please add labels and assign other collaborators for a review. -->\r\n\r\n### Describe the pull request:\r\n<!-- Replace [ ] with [x] to select options. -->\r\n- [ ] Bug fix\r\n- [ ] Functional change\r\n- [ ] New feature\r\n- [x] Code cleanup\r\n- [ ] Build system change\r\n- [ ] Documentation change\r\n- [ ] Language translation\r\n\r\n### Pull request long description:\r\n<!-- Describe your pull request in detail. -->\r\nWhile looking at my undo-branch it occurred to me that the split-out `free_dive()` function frees less than the `clean_dive()` function. I'm not 100% sure, because the code is convoluted - but doesn't that mean that the dive-deletion in `UndoDeleteDive::redo()` (desktop-widgets/undocommands.c) leaks memory?\r\n\r\nThe mobile version has a `clear_dive()` call, but I couldn't convince my self that all code-paths don't leak memory.\r\n\r\nThis commit tries to unify the free-dive-memory functions and adds a `free_dive()` function in preparation of the undo-work.\r\n\r\nIn case it isn't obvious, this is a bit experimental and therefore post-release material. Therefore I assign the `priority-low` tag.\r\n \r\n### Changes made:\r\n<!-- Enumerate the changes with 1), 2), 3) etc. -->\r\n<!-- Ensure the test cases are updated if needed. -->\r\n1) Move dive-memory freeing into a local functions.\r\n2) Split out `free_dive()` from `delete_single_dive()`\r\n\r\n### Related issues:\r\n<!-- Reference issues with #<issue-num>. -->\r\n<!-- Write \"Fixes #<issue-num\" to notify Github that this PR fixes an issue. -->\r\nNone.\r\n### Additional information:\r\n<!-- Include sample dive log or other relevant information to allow testing the change where feasible. -->\r\nNone.\r\n### Release note:\r\n<!-- Describe if this change needs a release note present in CHANGELOG.md. -->\r\n<!-- Also, please make sure to add the release note on top of the file CHANGELOG.md. -->\r\nNone.\r\n### Documentation change:\r\n<!-- If this PR makes changes to user functionality, then the documentation has to be updated too. -->\r\n<!-- Please, briefly outline here what has changed in terms of the user experience (UX). -->\r\n<!-- If UX changes have been made, a maintainer should apply the 'needs-documentation-change' label. -->\r\nNone.\r\n### Mentions:\r\n<!-- Mention users that you want to review your pull request with @<user-name>. Leave empty if not sure. -->\r\n","created_at":"2018-09-29T07:14:19Z","updated_at":"2018-09-29T21:11:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"852a140e2c007ee830a44bcc37205eacca0f46ad","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":753480128,"node_id":"MDU6TGFiZWw3NTM0ODAxMjg=","url":"https://api.github.com/repos/Subsurface-divelog/subsurface/labels/code-cleanup","name":"code-cleanup","color":"fbca04","default":false},{"id":700900224,"node_id":"MDU6TGFiZWw3MDA5MDAyMjQ=","url":"https://api.github.com/repos/Subsurface-divelog/subsurface/labels/core","name":"core","color":"d93f0b","default":false},{"id":700905353,"node_id":"MDU6TGFiZWw3MDA5MDUzNTM=","url":"https://api.github.com/repos/Subsurface-divelog/subsurface/labels/priority-low","name":"priority-low","color":"0e8a16","default":false},{"id":993821533,"node_id":"MDU6TGFiZWw5OTM4MjE1MzM=","url":"https://api.github.com/repos/Subsurface-divelog/subsurface/labels/rfc","name":"rfc","color":"0e8a16","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1732/commits","review_comments_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1732/comments","review_comment_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues/1732/comments","statuses_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/statuses/b409e86d52aca78d5853bd2674a15da92f6f6f27","head":{"label":"bstoeger:clean29","ref":"clean29","sha":"b409e86d52aca78d5853bd2674a15da92f6f6f27","user":{"login":"bstoeger","id":32835590,"node_id":"MDQ6VXNlcjMyODM1NTkw","avatar_url":"https://avatars3.githubusercontent.com/u/32835590?v=4","gravatar_id":"","url":"https://api.github.com/users/bstoeger","html_url":"https://github.com/bstoeger","followers_url":"https://api.github.com/users/bstoeger/followers","following_url":"https://api.github.com/users/bstoeger/following{/other_user}","gists_url":"https://api.github.com/users/bstoeger/gists{/gist_id}","starred_url":"https://api.github.com/users/bstoeger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bstoeger/subscriptions","organizations_url":"https://api.github.com/users/bstoeger/orgs","repos_url":"https://api.github.com/users/bstoeger/repos","events_url":"https://api.github.com/users/bstoeger/events{/privacy}","received_events_url":"https://api.github.com/users/bstoeger/received_events","type":"User","site_admin":false},"repo":{"id":107111280,"node_id":"MDEwOlJlcG9zaXRvcnkxMDcxMTEyODA=","name":"subsurface","full_name":"bstoeger/subsurface","private":false,"owner":{"login":"bstoeger","id":32835590,"node_id":"MDQ6VXNlcjMyODM1NTkw","avatar_url":"https://avatars3.githubusercontent.com/u/32835590?v=4","gravatar_id":"","url":"https://api.github.com/users/bstoeger","html_url":"https://github.com/bstoeger","followers_url":"https://api.github.com/users/bstoeger/followers","following_url":"https://api.github.com/users/bstoeger/following{/other_user}","gists_url":"https://api.github.com/users/bstoeger/gists{/gist_id}","starred_url":"https://api.github.com/users/bstoeger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bstoeger/subscriptions","organizations_url":"https://api.github.com/users/bstoeger/orgs","repos_url":"https://api.github.com/users/bstoeger/repos","events_url":"https://api.github.com/users/bstoeger/events{/privacy}","received_events_url":"https://api.github.com/users/bstoeger/received_events","type":"User","site_admin":false},"html_url":"https://github.com/bstoeger/subsurface","description":"This is the official upstream of the Subsurface divelog program","fork":true,"url":"https://api.github.com/repos/bstoeger/subsurface","forks_url":"https://api.github.com/repos/bstoeger/subsurface/forks","keys_url":"https://api.github.com/repos/bstoeger/subsurface/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bstoeger/subsurface/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bstoeger/subsurface/teams","hooks_url":"https://api.github.com/repos/bstoeger/subsurface/hooks","issue_events_url":"https://api.github.com/repos/bstoeger/subsurface/issues/events{/number}","events_url":"https://api.github.com/repos/bstoeger/subsurface/events","assignees_url":"https://api.github.com/repos/bstoeger/subsurface/assignees{/user}","branches_url":"https://api.github.com/repos/bstoeger/subsurface/branches{/branch}","tags_url":"https://api.github.com/repos/bstoeger/subsurface/tags","blobs_url":"https://api.github.com/repos/bstoeger/subsurface/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bstoeger/subsurface/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bstoeger/subsurface/git/refs{/sha}","trees_url":"https://api.github.com/repos/bstoeger/subsurface/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bstoeger/subsurface/statuses/{sha}","languages_url":"https://api.github.com/repos/bstoeger/subsurface/languages","stargazers_url":"https://api.github.com/repos/bstoeger/subsurface/stargazers","contributors_url":"https://api.github.com/repos/bstoeger/subsurface/contributors","subscribers_url":"https://api.github.com/repos/bstoeger/subsurface/subscribers","subscription_url":"https://api.github.com/repos/bstoeger/subsurface/subscription","commits_url":"https://api.github.com/repos/bstoeger/subsurface/commits{/sha}","git_commits_url":"https://api.github.com/repos/bstoeger/subsurface/git/commits{/sha}","comments_url":"https://api.github.com/repos/bstoeger/subsurface/comments{/number}","issue_comment_url":"https://api.github.com/repos/bstoeger/subsurface/issues/comments{/number}","contents_url":"https://api.github.com/repos/bstoeger/subsurface/contents/{+path}","compare_url":"https://api.github.com/repos/bstoeger/subsurface/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bstoeger/subsurface/merges","archive_url":"https://api.github.com/repos/bstoeger/subsurface/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bstoeger/subsurface/downloads","issues_url":"https://api.github.com/repos/bstoeger/subsurface/issues{/number}","pulls_url":"https://api.github.com/repos/bstoeger/subsurface/pulls{/number}","milestones_url":"https://api.github.com/repos/bstoeger/subsurface/milestones{/number}","notifications_url":"https://api.github.com/repos/bstoeger/subsurface/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bstoeger/subsurface/labels{/name}","releases_url":"https://api.github.com/repos/bstoeger/subsurface/releases{/id}","deployments_url":"https://api.github.com/repos/bstoeger/subsurface/deployments","created_at":"2017-10-16T10:11:10Z","updated_at":"2018-09-23T10:13:43Z","pushed_at":"2018-09-29T21:08:31Z","git_url":"git://github.com/bstoeger/subsurface.git","ssh_url":"git@github.com:bstoeger/subsurface.git","clone_url":"https://github.com/bstoeger/subsurface.git","svn_url":"https://github.com/bstoeger/subsurface","homepage":"https://subsurface-divelog.org","size":98895,"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":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Subsurface-divelog:master","ref":"master","sha":"fbc4b2ac722820f41f25cd72eeda3ce54cc356d0","user":{"login":"Subsurface-divelog","id":24829199,"node_id":"MDQ6VXNlcjI0ODI5MTk5","avatar_url":"https://avatars1.githubusercontent.com/u/24829199?v=4","gravatar_id":"","url":"https://api.github.com/users/Subsurface-divelog","html_url":"https://github.com/Subsurface-divelog","followers_url":"https://api.github.com/users/Subsurface-divelog/followers","following_url":"https://api.github.com/users/Subsurface-divelog/following{/other_user}","gists_url":"https://api.github.com/users/Subsurface-divelog/gists{/gist_id}","starred_url":"https://api.github.com/users/Subsurface-divelog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Subsurface-divelog/subscriptions","organizations_url":"https://api.github.com/users/Subsurface-divelog/orgs","repos_url":"https://api.github.com/users/Subsurface-divelog/repos","events_url":"https://api.github.com/users/Subsurface-divelog/events{/privacy}","received_events_url":"https://api.github.com/users/Subsurface-divelog/received_events","type":"User","site_admin":false},"repo":{"id":2319498,"node_id":"MDEwOlJlcG9zaXRvcnkyMzE5NDk4","name":"subsurface","full_name":"Subsurface-divelog/subsurface","private":false,"owner":{"login":"Subsurface-divelog","id":24829199,"node_id":"MDQ6VXNlcjI0ODI5MTk5","avatar_url":"https://avatars1.githubusercontent.com/u/24829199?v=4","gravatar_id":"","url":"https://api.github.com/users/Subsurface-divelog","html_url":"https://github.com/Subsurface-divelog","followers_url":"https://api.github.com/users/Subsurface-divelog/followers","following_url":"https://api.github.com/users/Subsurface-divelog/following{/other_user}","gists_url":"https://api.github.com/users/Subsurface-divelog/gists{/gist_id}","starred_url":"https://api.github.com/users/Subsurface-divelog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Subsurface-divelog/subscriptions","organizations_url":"https://api.github.com/users/Subsurface-divelog/orgs","repos_url":"https://api.github.com/users/Subsurface-divelog/repos","events_url":"https://api.github.com/users/Subsurface-divelog/events{/privacy}","received_events_url":"https://api.github.com/users/Subsurface-divelog/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Subsurface-divelog/subsurface","description":"This is the official upstream of the Subsurface divelog program","fork":false,"url":"https://api.github.com/repos/Subsurface-divelog/subsurface","forks_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/forks","keys_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/teams","hooks_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/hooks","issue_events_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues/events{/number}","events_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/events","assignees_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/assignees{/user}","branches_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/branches{/branch}","tags_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/tags","blobs_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/refs{/sha}","trees_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/statuses/{sha}","languages_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/languages","stargazers_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/stargazers","contributors_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/contributors","subscribers_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/subscribers","subscription_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/subscription","commits_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/commits{/sha}","git_commits_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/git/commits{/sha}","comments_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/comments{/number}","issue_comment_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues/comments{/number}","contents_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/contents/{+path}","compare_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/merges","archive_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/downloads","issues_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues{/number}","pulls_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls{/number}","milestones_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/milestones{/number}","notifications_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/labels{/name}","releases_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/releases{/id}","deployments_url":"https://api.github.com/repos/Subsurface-divelog/subsurface/deployments","created_at":"2011-09-03T15:27:51Z","updated_at":"2018-09-29T21:02:13Z","pushed_at":"2018-09-29T21:08:33Z","git_url":"git://github.com/Subsurface-divelog/subsurface.git","ssh_url":"git@github.com:Subsurface-divelog/subsurface.git","clone_url":"https://github.com/Subsurface-divelog/subsurface.git","svn_url":"https://github.com/Subsurface-divelog/subsurface","homepage":"https://subsurface-divelog.org","size":98824,"stargazers_count":1441,"watchers_count":1441,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":363,"mirror_url":null,"archived":false,"open_issues_count":92,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":363,"open_issues":92,"watchers":1441,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1732"},"html":{"href":"https://github.com/Subsurface-divelog/subsurface/pull/1732"},"issue":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues/1732"},"comments":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/issues/1732/comments"},"review_comments":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1732/comments"},"review_comment":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/pulls/1732/commits"},"statuses":{"href":"https://api.github.com/repos/Subsurface-divelog/subsurface/statuses/b409e86d52aca78d5853bd2674a15da92f6f6f27"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"dirkhh"}}