fts_query_free(): Fix a potential assertion failure

The ownership of the field query->intersection usually transfers
to query->doc_ids. In some error scenario, it could be possible
that fts_query_free() would be invoked with query->intersection!=NULL.
Let us handle that case, instead of intentionally crashing the server.
This commit is contained in:
Marko Mäkelä 2017-10-18 10:20:25 +03:00
parent 30e89acd95
commit babbf8c6fc
2 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -3633,6 +3634,10 @@ fts_query_free(
fts_doc_ids_free(query->deleted);
}
if (query->intersection) {
fts_query_free_doc_ids(query, query->intersection);
}
if (query->doc_ids) {
fts_query_free_doc_ids(query, query->doc_ids);
}
@ -3657,8 +3662,6 @@ fts_query_free(
rbt_free(query->word_freqs);
}
ut_a(!query->intersection);
if (query->word_map) {
rbt_free(query->word_map);
}

View File

@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -3653,6 +3654,10 @@ fts_query_free(
fts_doc_ids_free(query->deleted);
}
if (query->intersection) {
fts_query_free_doc_ids(query, query->intersection);
}
if (query->doc_ids) {
fts_query_free_doc_ids(query, query->doc_ids);
}
@ -3677,8 +3682,6 @@ fts_query_free(
rbt_free(query->word_freqs);
}
ut_a(!query->intersection);
if (query->word_map) {
rbt_free(query->word_map);
}