8000 Apply the heap vs. stack fix for PG::Result#fields too. · danielcode/ruby-pg@07d33ca · GitHub
[go: up one dir, main page]

Skip to content

Commit 07d33ca

Browse files
committed
Apply the heap vs. stack fix for PG::Result#fields too.
1 parent 490bbb5 commit 07d33ca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ext/pg_result.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -861,16 +861,16 @@ pgresult_fields(VALUE self)
861861
{
862862
PGresult *result = pgresult_get( self );
863863
int n = PQnfields( result );
864-
VALUE fields[ n ];
864+
VALUE fields = rb_ary_new2( n );
865865
int i;
866866

867867
for ( i = 0; i < n; i++ ) {
868868
VALUE val = rb_tainted_str_new2(PQfname(result, i));
869869
ASSOCIATE_INDEX(val, self);
870-
fields[ i ] = val;
870+
rb_ary_store( fields, i, val );
871871
}
872872

873-
return rb_ary_new4( n, fields );
873+
return fields;
874874
}
875875

876876

0 commit comments

Comments
 (0)
0