Skip to content

Commit 9bb3f73

Browse files
committed
fix(results): check more results before free
1 parent da12e3a commit 9bb3f73

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/execute.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,9 @@ Base.IteratorSize(::Type{<:TextCursors}) = Base.SizeUnknown()
203203
function Base.iterate(cursor::TextCursors{buffered}, first=true) where {buffered}
204204
cursor.cursor.result.ptr == C_NULL && return nothing
205205
if !first
206+
has_more_results = API.moreresults(cursor.cursor.conn.mysql)
206207
finalize(cursor.cursor.result)
207-
if API.moreresults(cursor.cursor.conn.mysql)
208+
if has_more_results
208209
@assert API.nextresult(cursor.cursor.conn.mysql) !== nothing
209210
cursor.cursor.result = buffered ? API.storeresult(cursor.cursor.conn.mysql) : API.useresult(cursor.cursor.conn.mysql)
210211
if buffered

0 commit comments

Comments
 (0)