← Back to team overview

drizzle-discuss team mailing list archive

libdrizzle: drizzle_result_create on a used result structure?


I found a bug in my program caused by me not calling drizzle_result_free before reusing a drizzle_result_st structure. This ends up causing an infinite loop when drizzle_result_free gets called in the future, since both the next and prev pointers point to the same thing.

I have a hack in my branch to detect this error in one case: if you attempt to re-use the result structure with the same connection, I search the connection's result list to see if it is already there. I can't solve the case where you attempt to use it with another connection. This will likely cause a double free or similar situation. I'm unsure if this is worth actually including in libdrizzle, but the changeset is here for review:


As a side note, what is the libdrizzle policy about assertions? There are a few places where I could add assert() statements that would crash on this error (such as when result->next == result->prev). Personally I love assertions, since they would have made this error obvious, rather than me needing to debug an infinite loop.


Evan Jones

Follow ups