xfree or die hard

This commit is contained in:
Aaron Patterson 2010-08-20 09:16:22 -07:00
parent 731b456862
commit a684efd696

View File

@ -144,9 +144,13 @@ static VALUE each(VALUE self)
binds[i].error = &error[i];
}
/* FIXME: if this raises, we need to free our allocated buffers */
if(mysql_stmt_bind_result(stmt, binds))
if(mysql_stmt_bind_result(stmt, binds)) {
xfree(binds);
xfree(is_null);
xfree(error);
xfree(length);
rb_raise(cMysql2Error, "%s", mysql_stmt_error(stmt));
}
while(!mysql_stmt_fetch(stmt)) {
VALUE row = rb_ary_new2((long)field_count);