Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various patches #2

Merged
11 commits merged into from
Jan 27, 2011
Merged

Various patches #2

11 commits merged into from
Jan 27, 2011

Conversation

neilconway
Copy link
Contributor

Fixes for memory leaks, compiler warnings, double free(), a minor bug in #get(), and unbreaks the build for OSX 10.6 (the last is maybe not the best way to do it, but works-for-me).

Not clear that this is the right fix, but unbreaks the build
for me.
strlen() + strcpy() is silly.
Previously assigned to the wrong union member -- not super likely
to cause a problem, but illegal per C99 strict aliasing.
If #close() was invoked, zookeeper_close() might be invoked
again by the Ruby GC, leading to a double free(). The previous
coding also neglected to call zookeeper_close() on a
non-connected ZK handle, which would leak resources.
This patch fixes a per-connection memory leak: the previous
coding allocated a zkrb_calling_context for each ZK handle
but neglected to free it.

This patch also raises a Ruby exception if any operations
on performed on a closed ZK handle, until #reopen() is
called. Such operations would just segfault anyway.
ZK allows a path to be created that has no associated data. In
the previous coding, doing a #get() on such a path would result
in raising a Ruby exception: zoo_get() returns data_len == -1
for the path, which isn't a legal string length.
@syrnick syrnick mentioned this pull request Jan 28, 2013
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant