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

Fix crash if a Mysql2::Client object is allocated but never connected #1101

Merged

Conversation

sodabrew
Copy link
Collaborator

@sodabrew sodabrew commented Jan 4, 2020

Reproducible with any older version of the mysql2 gem:

    ruby -r mysql2 -I lib -e 'Mysql2::Client.allocate.close'

Before this fix, the line above would crash out with a memory error:

    malloc: *** error for object 0x...: pointer being freed was not allocated
    malloc: *** set a breakpoint in malloc_error_break to debug
    Abort trap: 6

Alternative to #1097

@sodabrew sodabrew added this to the 0.5.4 milestone Jan 4, 2020
@sodabrew sodabrew force-pushed the fix-mysql2-client-allocate-close branch from 15b544a to 526d5eb Compare January 5, 2020 01:42
Reproducible with any older version of the mysql2 gem:

    ruby -r mysql2 -I lib -e 'Mysql2::Client.allocate.close'

Before this fix, the line above would crash out with a memory error:

    malloc: *** error for object 0x...: pointer being freed was not allocated
    malloc: *** set a breakpoint in malloc_error_break to debug
    Abort trap: 6
@sodabrew sodabrew force-pushed the fix-mysql2-client-allocate-close branch from 526d5eb to 5449df4 Compare January 5, 2020 01:48
@sodabrew
Copy link
Collaborator Author

sodabrew commented Jan 5, 2020

@nobu I want to check with you if this resolves the same crash at #1097, or if you saw a different crash (and how to reproduce it?)

@nobu
Copy link
Contributor

nobu commented Jan 9, 2020

Thank you, I confirmed that it worked fine.

@sodabrew sodabrew merged commit f8560c5 into brianmario:master Jan 9, 2020
@sodabrew sodabrew deleted the fix-mysql2-client-allocate-close branch January 9, 2020 15:51
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.

2 participants