]> granicus.if.org Git - postgresql/commitdiff
Fix minor memory leak in PLy_typeinfo_dealloc().
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 13 Mar 2012 17:28:11 +0000 (13:28 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 13 Mar 2012 17:28:11 +0000 (13:28 -0400)
We forgot to free the per-attribute array element descriptors.

Jan UrbaƄski

src/pl/plpython/plpy_typeio.c

index 1cc9b1e210e09b3e2b962a75c7d80468ce4ab915..d04fe46d4b77ebf3f116f8879ebe00466bf5c371 100644 (file)
@@ -74,8 +74,20 @@ PLy_typeinfo_dealloc(PLyTypeInfo *arg)
 {
        if (arg->is_rowtype == 1)
        {
+               int                     i;
+
+               for (i = 0; i < arg->in.r.natts; i++)
+               {
+                       if (arg->in.r.atts[i].elm != NULL)
+                               PLy_free(arg->in.r.atts[i].elm);
+               }
                if (arg->in.r.atts)
                        PLy_free(arg->in.r.atts);
+               for (i = 0; i < arg->out.r.natts; i++)
+               {
+                       if (arg->out.r.atts[i].elm != NULL)
+                               PLy_free(arg->out.r.atts[i].elm);
+               }
                if (arg->out.r.atts)
                        PLy_free(arg->out.r.atts);
        }