{"action":"created","issue":{"url":"https://api.github.com/repos/zeromq/czmq/issues/1155","labels_url":"https://api.github.com/repos/zeromq/czmq/issues/1155/labels{/name}","comments_url":"https://api.github.com/repos/zeromq/czmq/issues/1155/comments","events_url":"https://api.github.com/repos/zeromq/czmq/issues/1155/events","html_url":"https://github.com/zeromq/czmq/issues/1155","id":117259797,"number":1155,"title":"free() is used instead of zstr_free(), as the documentation advises","user":{"login":"paddor","id":8876,"avatar_url":"https://avatars.githubusercontent.com/u/8876?v=3","gravatar_id":"","url":"https://api.github.com/users/paddor","html_url":"https://github.com/paddor","followers_url":"https://api.github.com/users/paddor/followers","following_url":"https://api.github.com/users/paddor/following{/other_user}","gists_url":"https://api.github.com/users/paddor/gists{/gist_id}","starred_url":"https://api.github.com/users/paddor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paddor/subscriptions","organizations_url":"https://api.github.com/users/paddor/orgs","repos_url":"https://api.github.com/users/paddor/repos","events_url":"https://api.github.com/users/paddor/events{/privacy}","received_events_url":"https://api.github.com/users/paddor/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-17T01:29:53Z","updated_at":"2015-11-17T02:24:55Z","closed_at":null,"body":"For example `zsock_bind()` uses `zsys_vprintf()`. The documentation for `zsys_vprintf()` says `[...]  Free the returned string using zstr_free().`, but actually it uses a plain `free()`. I see that `zstr_free()` doesn't a whole lot more, but I guess this is a code smell. Not sure though. I'm not a C expert.\r\n\r\nSame in `zsock_unbind()`, `zsock_connect()`, and `zsock_disconnect()`."},"comment":{"url":"https://api.github.com/repos/zeromq/czmq/issues/comments/157245482","html_url":"https://github.com/zeromq/czmq/issues/1155#issuecomment-157245482","issue_url":"https://api.github.com/repos/zeromq/czmq/issues/1155","id":157245482,"user":{"login":"jemc","id":4623870,"avatar_url":"https://avatars.githubusercontent.com/u/4623870?v=3","gravatar_id":"","url":"https://api.github.com/users/jemc","html_url":"https://github.com/jemc","followers_url":"https://api.github.com/users/jemc/followers","following_url":"https://api.github.com/users/jemc/following{/other_user}","gists_url":"https://api.github.com/users/jemc/gists{/gist_id}","starred_url":"https://api.github.com/users/jemc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jemc/subscriptions","organizations_url":"https://api.github.com/users/jemc/orgs","repos_url":"https://api.github.com/users/jemc/repos","events_url":"https://api.github.com/users/jemc/events{/privacy}","received_events_url":"https://api.github.com/users/jemc/received_events","type":"User","site_admin":false},"created_at":"2015-11-17T02:24:55Z","updated_at":"2015-11-17T02:24:55Z","body":"Feel free to file a PR.\r\n\r\nThe only difference between `zstr_free` and `free` is that `zstr_free` will nullify the caller's reference as a convenient way to prevent common code mistakes (using a reference after freeing it, because doing so could sometimes point to garbage data if that address has already been reused).\r\n\r\nSo `zstr_free` isn't strictly necessary if you're sure you're not making such mistakes, but could still be considered good practice to prevent issues with refactoring.\r\n\r\nPlease feel free to file a PR if the use of `free` in these places bothers you.  In this community, the burden of improvement is usually on the person who has an issue with the particular problem.  In return, we are always quick to merge improvements."}}