PL/Python: Fix type mixup
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 14 Jun 2013 01:42:42 +0000 (21:42 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 14 Jun 2013 01:42:42 +0000 (21:42 -0400)
Memory was allocated based on the sizeof a type that was not the type of
the pointer that the result was being assigned to.  The types happen to
be of the same size, but it's still wrong.

src/pl/plpython/plpy_typeio.c

index 8f2367d30425f38c4175312a75df1d32f2c27ec1..6a9a2cb974721d8ee37165222402d1679110fbe5 100644 (file)
@@ -200,7 +200,7 @@ PLy_output_tuple_funcs(PLyTypeInfo *arg, TupleDesc desc)
                if (arg->out.r.atts)
                        PLy_free(arg->out.r.atts);
                arg->out.r.natts = desc->natts;
-               arg->out.r.atts = PLy_malloc0(desc->natts * sizeof(PLyDatumToOb));
+               arg->out.r.atts = PLy_malloc0(desc->natts * sizeof(PLyObToDatum));
        }
 
        Assert(OidIsValid(desc->tdtypeid));