ged/ruby-pg — pull request #4 by jeremyevans (2014-09-05 22:18:59+00:00)
Title: Fix segfault when clearing result yielded to notice_receiver

This fixes issue #185 in bitbucket (which I reported). In order
to make a double free impossible, you need to make sure that
clearing the notice receiver result doesn't call PQclear. In
order to make a segfault impossible if accessing the notice
receiver result outside of the notice receiver proc, you need
to use rb_ensure to ensure the data pointer is cleared before
returning from the proc call.

This is the simplest implementation I could think of, using a
result subclass for the notice receiver results, where clear
doesn't call PQclear.