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

[inet.cpp] Wrong work with pointer: delete ptr; ptr=new ; [CORE6217] #6461

Closed
firebird-automations opened this issue Jan 7, 2020 · 6 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @ibprovider

inet.cpp, line 835-839

if \(host\.hasData\(\)\)
\{
	delete port\-\>port\_connection;
	port\-\>port\_connection = REMOTE\_make\_string\(host\.c\_str\(\)\);
\}

REMOTE_make_string may throw exception and "delete port->port_connection" will hold pointer to released (deleted) memory block.

Please assign nullptr to port->port_connection after delete operation:

if \(host\.hasData\(\)\)
\{
	delete port\-\>port\_connection;
            port\-\>port\_connection=nullptr;
	port\-\>port\_connection = REMOTE\_make\_string\(host\.c\_str\(\)\);
\}

Commits: 67dcc12 c6ffc03

@firebird-automations
Copy link
Collaborator Author

Commented by: @ibprovider

-

@firebird-automations
Copy link
Collaborator Author

Modified by: @ibprovider

description: inet.cpp, line 835-839

if \(host\.hasData\(\)\)
\{
	delete port\-\>port\_connection;
	port\-\>port\_connection = REMOTE\_make\_string\(host\.c\_str\(\)\);
\}

REMOTE_make_string may throw exception and "delete port->port_connection" will hold pointer to released (deleted) memory block.

Please assign nullptr to delete port->port_connection after delete operation:

if \(host\.hasData\(\)\)
\{
	delete port\-\>port\_connection;
            port\-\>port\_connection=nullptr;
	port\-\>port\_connection = REMOTE\_make\_string\(host\.c\_str\(\)\);
\}

=>

inet.cpp, line 835-839

if \(host\.hasData\(\)\)
\{
	delete port\-\>port\_connection;
	port\-\>port\_connection = REMOTE\_make\_string\(host\.c\_str\(\)\);
\}

REMOTE_make_string may throw exception and "delete port->port_connection" will hold pointer to released (deleted) memory block.

Please assign nullptr to port->port_connection after delete operation:

if \(host\.hasData\(\)\)
\{
	delete port\-\>port\_connection;
            port\-\>port\_connection=nullptr;
	port\-\>port\_connection = REMOTE\_make\_string\(host\.c\_str\(\)\);
\}

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

Version: 4.0 Beta 1 [ 10750 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 4.0 Beta 2 [ 10888 ]

Fix Version: 3.0.6 [ 10889 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Cannot be tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment