Commit babbf8c6 authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent 30e89acd
/*****************************************************************************
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);
}
......
/*****************************************************************************
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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment