I have the same problem too, the document mentions that
A prepared statement is also global to the session. If you create a prepared statement within a stored routine, it is not deallocated when the stored routine ends.
At first I thought it meant that he should be released explicitly.
But this is not the case.
source
share