-
Notifications
You must be signed in to change notification settings - Fork 11
fix null table pointer issue #2
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
base: 2.9.0-yb
Are you sure you want to change the base?
Conversation
|
Thanks @tigerzhang for the pull request submission and contribution. Would you mind completing this CLA (contributor license agreement) form https://docs.google.com/forms/d/11hn-vBGhOZRunclC3NKmSX1cvQVrU--r0ldDLqasRIo/edit. |
|
signed |
|
Thx @tigerzhang. @OlegLoginov - could you please review the pull request? |
|
|
||
| KeyspaceMetadata* keyspace = NULL; | ||
| TableMetadata::Ptr table; | ||
| TableMetadata::Ptr table(NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to init it by NULL due to default constructor of the object:
explicit SharedRefPtr(T* ptr = NULL)
So, please undo the change.
| } | ||
|
|
||
| table->add_index(IndexMetadata::from_row(index_name, buffer, row)); | ||
| if (table) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.
(Just for rare case when 'temp_table_name' is empty string.)
| table_name = temp_table_name; | ||
| table = keyspace->get_table(table_name); | ||
| if (!table) continue; | ||
| table->clear_indexes(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main problem is here. If the table is not found the 'table_name' must be reset!
So, the line
if (!table) continue;
must be changed into:
if (!table) { table_name.clear(); continue; }
There is a chance meta table is uninitialized. A segment fault will occur.