Skip to content

php: fix memory leak during creating channel#14017

Merged
ZhouyihaiDing merged 1 commit intogrpc:masterfrom
ZhouyihaiDing:php_channl_memory_leak
Jan 16, 2018
Merged

php: fix memory leak during creating channel#14017
ZhouyihaiDing merged 1 commit intogrpc:masterfrom
ZhouyihaiDing:php_channl_memory_leak

Conversation

@ZhouyihaiDing
Copy link
Copy Markdown
Contributor

When there is re-usable channel to be reuse, the arguments allocation for creating the channel should be freed.

@chingor13
Copy link
Copy Markdown
Contributor

Won't the conditional branch: https://github.com/ZhouyihaiDing/grpc/blob/a6f0e2482cfc7167b5ee834b0689c4f6ba0acac6/src/php/ext/grpc/channel.c#L110 also produce a memory leak?

It also seems unmaintainable to have the efrees spread across different functions. If this function allocates memory, I'd note that in the developer docs/comments and force the caller to free the memory in all cases, rather than just a few cases.

@ZhouyihaiDing ZhouyihaiDing force-pushed the php_channl_memory_leak branch from a6f0e24 to b6cdfca Compare January 16, 2018 16:07
@ZhouyihaiDing
Copy link
Copy Markdown
Contributor Author

Thanks!
I changed efree to the caller function

@ZhouyihaiDing ZhouyihaiDing merged commit 4b0e885 into grpc:master Jan 16, 2018
nicolasnoble added a commit that referenced this pull request Jan 16, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants