{"action":"closed","number":14,"pull_request":{"url":"https://api.github.com/repos/hughsie/colord/pulls/14","id":36236903,"html_url":"https://github.com/hughsie/colord/pull/14","diff_url":"https://github.com/hughsie/colord/pull/14.diff","patch_url":"https://github.com/hughsie/colord/pull/14.patch","issue_url":"https://api.github.com/repos/hughsie/colord/issues/14","number":14,"state":"closed","locked":false,"title":"cd_client_connect_cb(): do not leak strings","user":{"login":"LebedevRI","id":88600,"avatar_url":"https://avatars.githubusercontent.com/u/88600?v=3","gravatar_id":"","url":"https://api.github.com/users/LebedevRI","html_url":"https://github.com/LebedevRI","followers_url":"https://api.github.com/users/LebedevRI/followers","following_url":"https://api.github.com/users/LebedevRI/following{/other_user}","gists_url":"https://api.github.com/users/LebedevRI/gists{/gist_id}","starred_url":"https://api.github.com/users/LebedevRI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LebedevRI/subscriptions","organizations_url":"https://api.github.com/users/LebedevRI/orgs","repos_url":"https://api.github.com/users/LebedevRI/repos","events_url":"https://api.github.com/users/LebedevRI/events{/privacy}","received_events_url":"https://api.github.com/users/LebedevRI/received_events","type":"User","site_admin":false},"body":"I was working on fixing leaks in darktable, and found this.\r\n\r\nI have installed colord with this change into /usr/local, and verified that this fixes the LeakSanitizer complaint, makes darktable free of leaks in colord (or, at least i was not able to trigger others...) and does not seem to cause any side-effects (at least so far).\r\n\r\nThe reason is: client->priv is re-used several times, and cd_client_finalize()\r\nis called only once at the end, so if cd_client_connect_cb() is called more\r\nthan once, it will re-duplicate those 3 strings, and the memory allocated\r\npreviously will leak.\r\n\r\nFixes several following LeakSanitizer-detected leaks like:\r\n```\r\nDirect leak of 23 byte(s) in 1 object(s) allocated from:\r\n    0 0x7f647ff0474f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5474f)\r\n    1 0x7f647d29f799 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4f799)\r\n    2 0x7f647d2b812e in g_strdup (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x6812e)\r\n\r\n    3 0x7f6478cce792 in cd_client_connect_cb /home/lebedevri/src/colord/lib/colord/cd-client.c:382\r\nor\r\n    3 0x7f6478cce822 in cd_client_connect_cb /home/lebedevri/src/colord/lib/colord/cd-client.c:388\r\nor\r\n    3 0x7f6478cce8b9 in cd_client_connect_cb /home/lebedevri/src/colord/lib/colord/cd-client.c:392\r\n\r\n    4 0x7f647d82cdf6 in g_simple_async_result_complete (/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0+0x74df6)\r\n    5 0x7f647d82ce58 (/usr/lib/x86_64-linux-gnu/libgio-2.0.so.0+0x74e58)\r\n    6 0x7f647d299b4c in g_main_context_dispatch (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x49b4c)\r\n    7 0x7f647d299f1f (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x49f1f)\r\n    8 0x7f647d29a241 in g_main_loop_run (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4a241)\r\n    9 0x7f647f043bf4 in gtk_main (/usr/lib/x86_64-linux-gnu/libgtk-3.so.0+0x1ebbf4)\r\n    10 0x7f647fa17eab in dt_gui_gtk_run /home/lebedevri/darktable/src/gui/gtk.c:964\r\n    11 0x400cd3 in main /home/lebedevri/darktable/src/main.c:25\r\n    12 0x7f6477ff9b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)\r\n    13 0x400bb8 (/usr/local/bin/darktable+0x400bb8)\r\n```","created_at":"2015-05-26T19:30:33Z","updated_at":"2015-05-26T20:46:21Z","closed_at":"2015-05-26T20:46:21Z","merged_at":"2015-05-26T20:46:21Z","merge_commit_sha":"b19611f7707d227d061921666a73a47ed950f08e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hughsie/colord/pulls/14/commits","review_comments_url":"https://api.github.com/repos/hughsie/colord/pulls/14/comments","review_comment_url":"https://api.github.com/repos/hughsie/colord/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hughsie/colord/issues/14/comments","statuses_url":"https://api.github.com/repos/hughsie/colord/statuses/91a63a452c597dea27b3c819c959bd0a75b1e34e","head":{"label":"LebedevRI:cd_client_connect_cb-do-not-leak-strings","ref":"cd_client_connect_cb-do-not-leak-strings","sha":"91a63a452c597dea27b3c819c959bd0a75b1e34e","user":{"login":"LebedevRI","id":88600,"avatar_url":"https://avatars.githubusercontent.com/u/88600?v=3","gravatar_id":"","url":"https://api.github.com/users/LebedevRI","html_url":"https://github.com/LebedevRI","followers_url":"https://api.github.com/users/LebedevRI/followers","following_url":"https://api.github.com/users/LebedevRI/following{/other_user}","gists_url":"https://api.github.com/users/LebedevRI/gists{/gist_id}","starred_url":"https://api.github.com/users/LebedevRI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LebedevRI/subscriptions","organizations_url":"https://api.github.com/users/LebedevRI/orgs","repos_url":"https://api.github.com/users/LebedevRI/repos","events_url":"https://api.github.com/users/LebedevRI/events{/privacy}","received_events_url":"https://api.github.com/users/LebedevRI/received_events","type":"User","site_admin":false},"repo":{"id":36291717,"name":"colord","full_name":"LebedevRI/colord","owner":{"login":"LebedevRI","id":88600,"avatar_url":"https://avatars.githubusercontent.com/u/88600?v=3","gravatar_id":"","url":"https://api.github.com/users/LebedevRI","html_url":"https://github.com/LebedevRI","followers_url":"https://api.github.com/users/LebedevRI/followers","following_url":"https://api.github.com/users/LebedevRI/following{/other_user}","gists_url":"https://api.github.com/users/LebedevRI/gists{/gist_id}","starred_url":"https://api.github.com/users/LebedevRI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LebedevRI/subscriptions","organizations_url":"https://api.github.com/users/LebedevRI/orgs","repos_url":"https://api.github.com/users/LebedevRI/repos","events_url":"https://api.github.com/users/LebedevRI/events{/privacy}","received_events_url":"https://api.github.com/users/LebedevRI/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/LebedevRI/colord","description":"Making color management just work","fork":true,"url":"https://api.github.com/repos/LebedevRI/colord","forks_url":"https://api.github.com/repos/LebedevRI/colord/forks","keys_url":"https://api.github.com/repos/LebedevRI/colord/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LebedevRI/colord/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LebedevRI/colord/teams","hooks_url":"https://api.github.com/repos/LebedevRI/colord/hooks","issue_events_url":"https://api.github.com/repos/LebedevRI/colord/issues/events{/number}","events_url":"https://api.github.com/repos/LebedevRI/colord/events","assignees_url":"https://api.github.com/repos/LebedevRI/colord/assignees{/user}","branches_url":"https://api.github.com/repos/LebedevRI/colord/branches{/branch}","tags_url":"https://api.github.com/repos/LebedevRI/colord/tags","blobs_url":"https://api.github.com/repos/LebedevRI/colord/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LebedevRI/colord/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LebedevRI/colord/git/refs{/sha}","trees_url":"https://api.github.com/repos/LebedevRI/colord/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LebedevRI/colord/statuses/{sha}","languages_url":"https://api.github.com/repos/LebedevRI/colord/languages","stargazers_url":"https://api.github.com/repos/LebedevRI/colord/stargazers","contributors_url":"https://api.github.com/repos/LebedevRI/colord/contributors","subscribers_url":"https://api.github.com/repos/LebedevRI/colord/subscribers","subscription_url":"https://api.github.com/repos/LebedevRI/colord/subscription","commits_url":"https://api.github.com/repos/LebedevRI/colord/commits{/sha}","git_commits_url":"https://api.github.com/repos/LebedevRI/colord/git/commits{/sha}","comments_url":"https://api.github.com/repos/LebedevRI/colord/comments{/number}","issue_comment_url":"https://api.github.com/repos/LebedevRI/colord/issues/comments{/number}","contents_url":"https://api.github.com/repos/LebedevRI/colord/contents/{+path}","compare_url":"https://api.github.com/repos/LebedevRI/colord/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LebedevRI/colord/merges","archive_url":"https://api.github.com/repos/LebedevRI/colord/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LebedevRI/colord/downloads","issues_url":"https://api.github.com/repos/LebedevRI/colord/issues{/number}","pulls_url":"https://api.github.com/repos/LebedevRI/colord/pulls{/number}","milestones_url":"https://api.github.com/repos/LebedevRI/colord/milestones{/number}","notifications_url":"https://api.github.com/repos/LebedevRI/colord/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LebedevRI/colord/labels{/name}","releases_url":"https://api.github.com/repos/LebedevRI/colord/releases{/id}","created_at":"2015-05-26T11:32:49Z","updated_at":"2015-05-26T11:32:51Z","pushed_at":"2015-05-26T19:27:34Z","git_url":"git://github.com/LebedevRI/colord.git","ssh_url":"git@github.com:LebedevRI/colord.git","clone_url":"https://github.com/LebedevRI/colord.git","svn_url":"https://github.com/LebedevRI/colord","homepage":null,"size":11369,"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":"hughsie:master","ref":"master","sha":"121e06d1aafd07118ee5e900623eca5e39cf5d40","user":{"login":"hughsie","id":151380,"avatar_url":"https://avatars.githubusercontent.com/u/151380?v=3","gravatar_id":"","url":"https://api.github.com/users/hughsie","html_url":"https://github.com/hughsie","followers_url":"https://api.github.com/users/hughsie/followers","following_url":"https://api.github.com/users/hughsie/following{/other_user}","gists_url":"https://api.github.com/users/hughsie/gists{/gist_id}","starred_url":"https://api.github.com/users/hughsie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hughsie/subscriptions","organizations_url":"https://api.github.com/users/hughsie/orgs","repos_url":"https://api.github.com/users/hughsie/repos","events_url":"https://api.github.com/users/hughsie/events{/privacy}","received_events_url":"https://api.github.com/users/hughsie/received_events","type":"User","site_admin":false},"repo":{"id":9096407,"name":"colord","full_name":"hughsie/colord","owner":{"login":"hughsie","id":151380,"avatar_url":"https://avatars.githubusercontent.com/u/151380?v=3","gravatar_id":"","url":"https://api.github.com/users/hughsie","html_url":"https://github.com/hughsie","followers_url":"https://api.github.com/users/hughsie/followers","following_url":"https://api.github.com/users/hughsie/following{/other_user}","gists_url":"https://api.github.com/users/hughsie/gists{/gist_id}","starred_url":"https://api.github.com/users/hughsie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hughsie/subscriptions","organizations_url":"https://api.github.com/users/hughsie/orgs","repos_url":"https://api.github.com/users/hughsie/repos","events_url":"https://api.github.com/users/hughsie/events{/privacy}","received_events_url":"https://api.github.com/users/hughsie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hughsie/colord","description":"Making color management just work","fork":false,"url":"https://api.github.com/repos/hughsie/colord","forks_url":"https://api.github.com/repos/hughsie/colord/forks","keys_url":"https://api.github.com/repos/hughsie/colord/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hughsie/colord/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hughsie/colord/teams","hooks_url":"https://api.github.com/repos/hughsie/colord/hooks","issue_events_url":"https://api.github.com/repos/hughsie/colord/issues/events{/number}","events_url":"https://api.github.com/repos/hughsie/colord/events","assignees_url":"https://api.github.com/repos/hughsie/colord/assignees{/user}","branches_url":"https://api.github.com/repos/hughsie/colord/branches{/branch}","tags_url":"https://api.github.com/repos/hughsie/colord/tags","blobs_url":"https://api.github.com/repos/hughsie/colord/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hughsie/colord/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hughsie/colord/git/refs{/sha}","trees_url":"https://api.github.com/repos/hughsie/colord/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hughsie/colord/statuses/{sha}","languages_url":"https://api.github.com/repos/hughsie/colord/languages","stargazers_url":"https://api.github.com/repos/hughsie/colord/stargazers","contributors_url":"https://api.github.com/repos/hughsie/colord/contributors","subscribers_url":"https://api.github.com/repos/hughsie/colord/subscribers","subscription_url":"https://api.github.com/repos/hughsie/colord/subscription","commits_url":"https://api.github.com/repos/hughsie/colord/commits{/sha}","git_commits_url":"https://api.github.com/repos/hughsie/colord/git/commits{/sha}","comments_url":"https://api.github.com/repos/hughsie/colord/comments{/number}","issue_comment_url":"https://api.github.com/repos/hughsie/colord/issues/comments{/number}","contents_url":"https://api.github.com/repos/hughsie/colord/contents/{+path}","compare_url":"https://api.github.com/repos/hughsie/colord/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hughsie/colord/merges","archive_url":"https://api.github.com/repos/hughsie/colord/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hughsie/colord/downloads","issues_url":"https://api.github.com/repos/hughsie/colord/issues{/number}","pulls_url":"https://api.github.com/repos/hughsie/colord/pulls{/number}","milestones_url":"https://api.github.com/repos/hughsie/colord/milestones{/number}","notifications_url":"https://api.github.com/repos/hughsie/colord/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hughsie/colord/labels{/name}","releases_url":"https://api.github.com/repos/hughsie/colord/releases{/id}","created_at":"2013-03-29T10:15:25Z","updated_at":"2015-05-06T11:21:43Z","pushed_at":"2015-05-26T20:46:21Z","git_url":"git://github.com/hughsie/colord.git","ssh_url":"git@github.com:hughsie/colord.git","clone_url":"https://github.com/hughsie/colord.git","svn_url":"https://github.com/hughsie/colord","homepage":null,"size":12661,"stargazers_count":9,"watchers_count":9,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":3,"forks":8,"open_issues":3,"watchers":9,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hughsie/colord/pulls/14"},"html":{"href":"https://github.com/hughsie/colord/pull/14"},"issue":{"href":"https://api.github.com/repos/hughsie/colord/issues/14"},"comments":{"href":"https://api.github.com/repos/hughsie/colord/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/hughsie/colord/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/hughsie/colord/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hughsie/colord/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/hughsie/colord/statuses/91a63a452c597dea27b3c819c959bd0a75b1e34e"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"hughsie","id":151380,"avatar_url":"https://avatars.githubusercontent.com/u/151380?v=3","gravatar_id":"","url":"https://api.github.com/users/hughsie","html_url":"https://github.com/hughsie","followers_url":"https://api.github.com/users/hughsie/followers","following_url":"https://api.github.com/users/hughsie/following{/other_user}","gists_url":"https://api.github.com/users/hughsie/gists{/gist_id}","starred_url":"https://api.github.com/users/hughsie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hughsie/subscriptions","organizations_url":"https://api.github.com/users/hughsie/orgs","repos_url":"https://api.github.com/users/hughsie/repos","events_url":"https://api.github.com/users/hughsie/events{/privacy}","received_events_url":"https://api.github.com/users/hughsie/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"commits":1,"additions":11,"deletions":3,"changed_files":1}}