-
Notifications
You must be signed in to change notification settings - Fork 8k
fix memory leak in pdo_pgsql closeCursor (bug 69752) #1319
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
Conversation
|
currently investigating the test failures. Please stay tuned |
|
I have fixed the fix to deal with the failing test cases. Please note that even without this patch, |
|
@pilif what is the diff you've got for that test? |
|
@weltling the issue was on my end, running the tests with a clean php built with just |
|
@pilif, you mean the issue you originally reported isn't reproducable anymore? Then probably no need to merge the patch. Thanks. |
|
@weltling no. The original issue is reproducible and the memory leak exists. But the non-related test that was failing before doesn't fail any more. So on my machine now: Current PHP-5.6 HEAD:
With this PR applied:
|
|
@pilif ah, so i misunderstood then. Ok, gonna test it then. Btw did you check the same exists in 5.5 by chance? Thanks. |
|
@weltling - I haven't actually tested it, but the So I would say everything after 2d4b8e1 leaks and everything before crashes. |
|
@pilif tested your patch - the functionality is ok. I would right apply it, but it seems to have a small charset issue. You seem to have saved some weird chars in there which look like space. Please check what i see when opening the downloaded patch with a non multibyte charset
something is definitely looks like a unicode char, Visual Studio at least fails to compile it. Please put a plain space there :) Thanks. |
|
oh crap. I'm terribly sorry about this. This is a non-breaking space which happens to me all the time with my swiss german keyboard as the sign is Alt-Space and to make the | sign, I have to type Alt-7. So if I leave the finger on Alt for just a small moment too long, this sneaky sucker gets added which looks just like a normal space. I'll rebase a fixed patch and notify you again. Terribly sorry about this - neither gcc nor clang seemed to mind :/ |
the parent PDO closeCursor method resets the pdo_stmt_t's executed flag which is used by the postgres driver as a flag to check whether to allocate memory for the column data or not. This means that after the parent closeCursor() has been called, the pdo_pgsql driver will allocate a new buffer for the columns, so the existing buffer should be freed when the cursor is being closed.
|
Fine now, gonna merge. Thanks ) |
|
there we go. Squeaky clean without U+00a0 Sorry about wasting your time. |
|
Comment on behalf of ab at php.net: Merged into 5.5+. Thanks your work :) |
the parent PDO closeCursor method resets the pdo_stmt_t's executed flag
which is used by the postgres driver as a flag to check whether to
allocate memory for the column data or not.
This means that after the parent closeCursor() has been called, the
pdo_pgsql driver will allocate a new buffer for the columns, so the
existing buffer should be freed when the cursor is being closed.