Patch to fix memory leak in fetch in Python interface. - Mailing list pgsql-patches

From Stephen Robert Norris
Subject Patch to fix memory leak in fetch in Python interface.
Date
Msg-id 1003358787.31478.1.camel@ws12
Whole thread Raw
Responses Re: Patch to fix memory leak in fetch in Python interface.
Re: Patch to fix memory leak in fetch in Python interface.
List pgsql-patches
This stops the interface from leaking the row tuples (and thus the
results of every fetch).

    Stephen

--- pgmodule.c    Wed Oct 17 17:07:05 2001
+++ pgmodule.c.orig    Thu Oct 18 08:39:52 2001
@@ -561,11 +561,11 @@
             }
             else
                 str = PyString_FromString(PQgetvalue(self->last_result,
self->current_row, j));
-            PyTuple_SET_ITEM(rowtuple, j, str);
+            Py_DECREF(str);
+            PyTuple_SET_ITEM(rowtuple, j, Py_None);
         }

         PyList_Append(reslist, rowtuple);
-        Py_DECREF(rowtuple);
         self->current_row++;
     }


Attachment

pgsql-patches by date:

Previous
From: Bill Studenmund
Date:
Subject: Packages patch
Next
From: Stephen Robert Norris
Date:
Subject: Re: Patch to fix memory leak in fetch in Python interface.