The problem is that if the loop above doesn't find a result set with
command tag "FETCH ...", res is left to point to an already-freed result
set, and we'll go ahead and call QR_set_withhold on the already-freed
struct. That can't happen in practice, because the backend does always
return a result set with "FETCH ..." command tag when a FETCH statement is
issued, but better safe than sorry.
qres = nres;
}
}
- if (SC_is_with_hold(self))
+ if (res && SC_is_with_hold(self))
QR_set_withhold(res);
}
mylog(" done sending the query:\n");