Skip site navigation (1) Skip section navigation (2)

Patch to fix memory leak in fetch in Python interface.

From: Stephen Robert Norris <srn(at)commsecure(dot)com(dot)au>
To: pgsql-patches(at)postgresql(dot)org
Subject: Patch to fix memory leak in fetch in Python interface.
Date: 2001-10-17 22:46:27
Message-ID: 1003358787.31478.1.camel@ws12 (view raw or flat)
Thread:
Lists: 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++;
 	}

Responses

pgsql-patches by date

Next:From: Stephen Robert NorrisDate: 2001-10-17 22:56:47
Subject: Re: Patch to fix memory leak in fetch in Python interface.
Previous:From: Marko KreenDate: 2001-10-17 22:31:34
Subject: Re: Ant configuration

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group