RowFilter is derived from RefCountedObject, which is fine for the intended purpose. However, RecordSet uses a plain pointer in its interfaces to pass and obtain the RowFilter instance. This should be changed to a Poco::AutoPtr. Also, a Poco::AutoPtr should be used by RecordSet to hold the RowFilter instance instead of a plain pointer and manually calling duplicate()/release().
Furthermore, RowFilter calls duplicate()/release() on itself in init(), and its destructor, respectively. This is plainly wrong as it will prevent ever deleting a RowFilter instance.
@aleks-f